Saturday, June 18, 2016

How to make a markov twitter bot using Heroku

I am going to do my best to make a simple tutorial for those who want to make a twitter bot. This only covers a bot that will respond to tweets and things like that. The bot will live on a server so you don't have to keep your computer running to keep the bot alive. That's a good thing. Your source Twitter account will need to be public for this to work.
  • Make a new Twitter account for your bot.
  • Add your phone number to your bot. (You can use a Google Voice number if you want)
Now, go to Heroku and get an account. This is where you may feel a bit weary, and I get that because they will ask for credit card information. This is only to verify that you're not a spammer creating multiple accounts for nefarious use. If you follow my steps exactly, you should not be charged. I'm not responsible if you are charged because their policies change or you change a setting however. I have no affiliation with Heroku so I have no incentive to get you to pay for anything.

The next step is to actually create the bot. Over on Github, boodoo_ebooks is a great template that is perhaps the easiest way to set this up. Let me walk you through:

Now that you have a Heroku account and a Twitter account for your bot (and verified the emails for both accounts), click this link.

This will popup a window that looks like below:



You do not have to fill out the App Name, so scroll down to the "Config Variables"
  • In the BOT_NAME field, input your bot's twitter account username without the @ symbol.
  • In the SOURCE_USERNAME field, enter your original Twitter account name that you'd like your bot to pull tweets from without the @.
Now, pay very close attention to the terminology I use here as it can be confusing to new users. Leaving the Heroku page open, go to the Twitter Apps page. Before doing this, make sure you have a phone number attached to your Twitter bot's account and that you are logged into your bot's account or you will not be able to accomplish this next step.
  • Click "Create New App"
  • Fill out the name, description, and website field however you like. Typically I name the Application the same as my bot's twitter name and make the website link to my bot's twitter profile. 
  • You do not need to fill out the "Callback URL" field.
  • Scroll down, check the "Yes, I agree" button and then click "Create your Twitter Application"
  • If you aren't able to create the app, you probably don't have a phone number attached to your Twitter bot account.
  • You should be taken to this page:
  • Click the "Permissions" tab.
  • Click "Read, Write and Access direct messages"
  • Click Update Settings.
  • Click the "Keys and Access tokens" tab.
  • Click "Create my Access Token"
  • You should now have an "Access Token" and an "Access Token Secret"
Now, open back up the Heroku page from earlier. 

  • In the "CONSUMER_KEY" field, copy and paste the code from the "Consumer Key (API Key)" field from your Twitter App page.
  • In the "CONSUMER_SECRET" field, copy and paste the code from the "Consumer Secret (API Key)" field from your Twitter App page.
  • In the "ACCESS_TOKEN" field, copy and paste the code from the "Access Token" field from your Twitter App page.
  • In the "ACCESS_TOKEN_SECRET" field, copy and paste the code from the "Access Token Secret" field from your Twitter App page.
  • Make sure there are no spaces before and after the codes once you paste them.
For example:
  • In the "TWEET_INTERVAL" field, this is where you set the interval between automatic tweets for your bot. Assbott is set to "29m" for every 29 minutes. You can set this however you'd like. The default is "2h" for every 2 hours.
  • "TWEET_CHANCE" is how much of a chance you'd like your bot to have when it hits that time interval. The default is 0.8, meaning your bot has an 80% chance to tweet every time it hits the amount of time you specified. You can set this to 1.0 if you'd like it to tweet 100% of the time the time interval hits.
  • "BLACKLIST" is where you can set who you'd like your bot to not ever respond to or follow. By default, it's set to Dril and tinysubversions. You can add additional usernames without the @ seperated by a comma.
  • "BANNED_TERMS" are the words you'd like your bot to ignore if tweeted. Separate these by commas.
  • "SPECIAL_TERMS" are words you'd like your bot to think of as being special so that your bot will engage more if it sees them. For instance, if I specify "Twitter" to be a special term, my bot is more likely to like, retweet, or reply to a tweet that has "Twitter" somewhere in it. Special terms are also automatically defined when your bot is updated, so this isn't a necessary field unless you want to tip the scales a little bit. Separate these by commas.
  • "DEFAULT_DELAY" is the delay range your bot will use when it decides to tweet. By default it is set to "5..60" meaning between 5 and 60 seconds. Twitter has a somewhat strict limit on how many tweets, follows, etc. it can do within a certain amount of time, so it's good to have some sort of delay. I would leave this alone unless you're certain you want to change it.
  • The "DM_DELAY", "MENTION_DELAY", and "TIMELINE_DELAY" fields are the same as the "DEFAULT_DELAY" field. I'd leave these alone unless you know what you're doing.
  • "TIMEOUT_SLEEP" is, in seconds, how long you'd like your bot to go to sleep if it hits a rate limit. I'd leave this alone.
  • "MAX_ERROR_RETRIES" is how many times you'd like your bot to retry to connect after it is disconnected from the Twitter server. You should have no reason to change this one.
  • "UPDATE_FOLLOWS_INTERVAL" can be set the same way as "TWEET_INTERVAL". Your bot will autofollow those who follow it at the time interval you specify here. The default is 90 minutes which is a good place to keep it to prevent rate limiting errors.
  • Click "Deploy for Free"
Now, assuming you specified everything correctly, your bot should deploy on the server after about 30 seconds. Just one more step and we're done.
  • Click "Manage App"
  • Click the "Resources" tab
  • Click the pencil icon next to "$0.00".
  • Click the toggle that looks like this:
  • So that it looks like this:
  • Click the "Confirm" button.
Now, you should be done and your bot should be running. Try replying to it with your normal account to double check. It should reply back with a garbled sentence from your tweet history.

Using your normal account, you can DM your bot commands like "mention, follow, unfollow, block, and tweet". If you DM your bot (without quotes) "mention @twitter", it should tweet something at @twitter. This implementation I have found to be temperamental however so don't be surprised if it doesn't work all that well.

Sunday, June 12, 2016

Wordpress Submit to Google Index Button

This is a plugin that places a "Submit to Google" button in your editor page for published posts.

Make sure you are already signed up with Google Webmaster Tools and that your Wordpress site url matches the one registered with Google Webmaster Tools.

Simply click the button on a published post and it will direct you to the Google Webmaster Tools page with your URL already filled in, making the process as simple as possible.

Monday, October 28, 2013

So you want to podcast on iTunes for free

Well, it's not really that hard but the setup is usually where people get caught up. You can record your sultry voice all day and night, but without iTunes it just doesn't seem to mean much does it? Here's a step-by-step 100% sure fire way to get your podcast on iTunes for free.

Step 1: Create an Archive.org account and begin uploading your files.

Sure, uploading your podcast files to mediafire or Tindeck works okay when just sharing them with your friends and stuff, but when it comes to RSS and iTunes they like things to be more permanent and standard. With Archive.org, you can create an account and upload unlimited mp3 files, for free. They also will create permanent links to download your podcast files that iTunes and RSS readers like.

Once you have an account, begin uploading your files. We'll get back to them later.

Step 2: Create a Blogger/Blogspot for your podcast and begin posting

Google has a blogging service that's easy and free called Blogger. Set a blog up for your podcast using this. The design doesn't need to be fancy, because it's likely people won't actually be viewing it all that often. Of course, it could be used a central commenting area. One setting you will want to change is under the Settings -> Other tab. The setting is called "Enable Title Links and Enclosure Links". Make sure it is set to "Yes." Anyhow, once you have a blog, we'll need to begin to create posts for it.

Create one post per episode you want to publish. Here's where you can screw things up. 

Title your posts as you'd like each episode to be called such as "Example Podcast Episode 1: I like things"

This is how it will show in the RSS feed and iTunes. 

Now, in Archive.org you should now be able to view your files. When viewing them, it should be fairly easy to find the link for a VBR MP3 version of your file. When you find that link, copy it. Now, paste it into Notepad or Textedit or equivelant. This is one of the easiest places to get tripped up.

When you copy the link from Archive.org, it will have "https" at the front of it. Take out the s. That's it. Yes, that's easy but KEEP IN MIND that iTunes will not accept or work with your podcast if you do not do this step. Now that you have taken out the s, copy the link again.

In the body of the post, this is where you'll want to put the description of the episode such as "In Episode 5 of the Example Podcast, we talk about things and stuff." Notice in the example, I put an Episode 5 identifier. You'll want to link Episode 5 to the file you uploaded to Archive.org as I did. Now, off to the right of the Blogger posting area, you should see the "Links" tab. In here, paste the link into the "Title Link" and "Enclosure Links". Click Done.

Now, you should be ready to Publish your blog post. Ta-da! You're ready to become an iTunes podcast superstar!

Except you're not.

Step 3: Create a Feedburner for your podcast

Why doesn't Blogger have a built-in RSS option? I don't know. But you can easily create one for your blog that works great with iTunes just as well on your own. Go to Feedburner, and create a new feed. Now, when you add a feed to Feedburner it will have a little checkbox next to the "Submit" button that says "I'm a podcaster!" Are you a podcaster? Well, yes you are. So check it.

Now, you'll get asked if you want the feed to be atom or rss. It doesn't matter so I always just leave it on Atom. Feed title and Feed Address go ahead and fill those in how you want. Probably best if the feed title was the name of your podcast. 

Keep clicking Next and you'll eventually get to a page called "Configure Your Podcast and Tell iTunes How to List It." Great, fantastic. Fill it all out as it pertains to your podcast, okay. Cool. Keep clicking next until you get to a page that says "Your feed is ready for the world." Up in the upper left corner of this page, there'll be a tiny little RSS icon with waves on it. Click on this to see your feed. Does it show a feed of the shows you added in Step 2? If not, you did something wrong. If it does show them, cool! Copy the link address to your feed page. You're almost done!

Step 4: Submit Your Podcast to iTunes

This is somehow, the easiest part of the whole ordeal. Open iTunes (or download it first). Click on "iTunes Store". Click on "Podcasts" at the top. Off to the right of the Store page there'll be a link that says "Submit a Podcast." Click that. Now, paste in your podcast feed link you got from Feedburner. It will then show you how your podcast will look to your listeners. Make sure it's correct (if not, you can edit it in your feedburner), and then click Submit!

TA DA!!!  Now you are done! In a few days, you'll probably get an email from Apple confirming your podcast's approval. Be patient. If Apple denies your request, I don't know what you did wrong and cannot help you there. Share your iTunes link for super stardom!

Popular Posts

Powered by Blogger.