The Fallacy of Twitter Bots

I’m going to be the first to admit that I use Python to send out Tweets to my followers. I have a few scripts that parse RSS feeds and do retweets on an hourly basis. They work fine but they do get ‘gamed’ occasionally. That’s the problem with automation, isn’t it? Getting gamed can cause all kinds of havoc for your brand and reputation, so you have to be careful.

Has this happened to me? Not really, but there has been a few embarrassing retweets and silly parsed advertisements in lieu of good articles.

Why bother with Twitter automation in the first place? Simple, everyone wants to be an ‘influencer’, myself included. Yet using automated methods to gain ‘eyeballs’ comes with a price. You end up sacrificing quality for quantity. You end up diluting your brand and losing the signal. In the end you get nothing but noise!

Signal vs Noise

At one time I tested/used @randal_olson‘s TwitterFollowBot to increase my follower count. It worked well and I started growing my followers in large clips. The script is pretty simple in logic, it follows people based on a certain hashtag (or followers of a Twitter handle) that you supply and does in about 100 people per run.

The goal here is to get a ‘follow back’ from the people you just followed, then auto mute them. If, after a week or so, they don’t follow you back you run another routine that ‘unfollows’ them and puts them on a black list not to ‘autofollow’ them again.

You run this script every few hours for a week and MY GAWD, does your following list explode! The noise becomes unbearable, even after muting them. You end up with cranks, conspiracy theorists, crypto-currency shills, and bots (most liked Russian bots). Yes, you do get a lot of follow backs but the quality signal of people you should really follow and interact with gets completely lost!

I stopped that experiment a few months ago and started unfollowing the noise. My following count is now below 1,000 but I feel that’s too much. I want to get that number to about 500. Of course, this resulted in my follower count dropping too. There’s a lot of Twitter users that also run ‘you unfollow me so I unfollow you’ scripts too. LOL.

Possible solutions

Just stop it. Stop all the Retweeting, TwitterBot following, and parsing. Instead do one or more of the following:

  1. Create a curated list of great links that you filter through. I know that @maoxian has done this over the years and it’s invaluable because he puts the time and effort in to filtering out the noise.
  2. Write a Python script to parse RSS feeds but write the links to a file so you can review later and tweet accordingly (more signal, less noise)
  3. Write a Python script to find ‘true’ influencers on Twitter and interact with them personally. Perhaps create a ranking system
  4. Something else that I’ll remember after I post this article

I guess lesson here is that we can’t automate the human touch. You can do a lot of the heavy lifting but in the end, it’s us that bring meaning and value to everything we do.

Extract Blog Post Links from RSS feeds

As part of my goal of automation here, I wrote a small script to extract blog post links from RSS feeds. using Python. I did this to extract the title and link of blog posts from a particular date range in my RSS feed. In theory, it should be pretty easy but I’ve come to find that time was not my friend.

What tripped me up was how some functions in python handle time objects. Read on to learn more!

What it does

What this script does is first scrape my RSS feed, then use a 7 day date range to extract the posted blog titles and links, and then writes it to a markdown file. Super simple, and you’ll need the feedparser library installed.

The real trick her is not the loop, but the timetuple(). This is where I first got tripped up.

I first created a variable for today’s date and another variable for 7 days before, like so:

The output of today becomes this: datetime.date(2018, 9, 8)
The output of week_ago becomes this: datetime.date(2018, 9, 1)

So far so good! The idea was to use a logic function like if post.date >= week_ago AND post.date <= today, then extract stuff.

So I parsed my feed and then using the built in time parsing features of feedparser, I wrote my logic function.

BOOM, it didn’t work. After sleuthing the problem I found that the dates extracted in feedparser were a timestruct object whereas my variables today and week_ago were datetime objects.

Enter timetuple() to the rescue. timetuple() changed the datetime object into a timestruct object by just doing this:

After that, it was straightforward to do the loop and write out the results, see below.

Python Script

Python Script to Parse Blog Feeds Version 2

I’m going to share an update to my original python script. It’s super simple and it completely automates parsing multiple blog feeds for you to autopost on Twitter.

The goal: automation!!!

Call the Python Modules!

Create a new empty python script. Call it awesomescript.py or something else. You’ll need to have feedparser and twython installed first. If you don’t go and do ‘pip install feedparser’ and ‘pip install Twython.’

The one thing you’ll notice is I’m calling a python file called ‘keys’ and importing a dictionary. All that this does is call my Twitter API keys from one central file. I do this because I have multiple scripts that call the same keys and instead of pasting them in each an every script, I just centralized it. Plus, it makes it easier to change the keys if I ever rate block myself, which is a fairly common occurrence with all my tinkering!

Twitter API Key dictionary

Ok, you need to get your API keys from Twitter. Do that first. Google how to do it. Then create a file called ‘keys.py’ and paste the following into it. Then paste in your Consumer Key, Consumer Secrete, Access Token, and Access Secret into where the ‘XXXXXXXXXXXXXXX’s are.

Calling the Dictonary of keys

Switch back to your main script and call in the key.py file by doing this:

Create the Feedlist you want to parse the RSS feed from

You’ll have to create a list of RSS feeds from where you want to parse the posts from. To do that you need to create a list in Python by doing something like ‘myvariable = []’

Make a Random Feed Selection and Parse the Feed

Next we’re going to randomly select a feed and then parse it via the feedparser library.

Extract the feed length and randomly select a Feed

This part is where I made the biggest change. I now parse the number of feeds and then automatically assign that number to a variable. This way I can create the correct feed range ‘on the fly’ because each feed is different. Some sites only give you 5 current feeds, others give you 20, etc. In my old feed, I just hard coded in a range value. That worked but wasn’t very dynamic.

Initialize Twitter API, Write the Status and Tweet Out!

The rest didn’t change much at all. You just initialize the Twitter API and write a status that appends the parsed feed information.

There you have it. A better version of my original script. The next goal is create a list of hashtags to randomly select against.

As always, please drop me a comment if you have questions.