Trump Twitter Bot

What

I just made a thing on Twitter. It is a “bot”. This python computer program runs on my computer and retweets Donald Trump’s (https://twitter.com/realDonaldTrump) Twitter account only if the original tweet came from an Android device. Here’s what it looks like for both a tweet from Trump and one that is probably not:

capture

Why

Research (http://varianceexplained.org/r/trump-tweets/) has shown that Donald uses an Android device to tweet whereas his staff tweet as him using other devices (such as iPhones, iPads and Twitter Web Clients). I find it confusing when watching his Twitter feed to see some tweets that he wrote and some his staff wrote. This Twitter account will ONLY retweet ones from an Android device, hopefully screening out (not retweeting) ones from his staff.

On Twitter, you cannot see what Twitter client a person used to tweet a message. That data is attached to the tweet and stored on Twitter’s servers and you can use its API (https://dev.twitter.com/docs) to get the data. People can follow my bot (https://twitter.com/IsItTrump) on Twitter and get only the Android ones that are most likely tweeted by Trump.

Another reason to write this was that I wanted to make a Twitter bot myself and this seemed like a good project.

Wait. I See a Problem.

Yes. There are several.

  1. What if his staffers start using an Android device to tweet?
  2. What if he gets an iPhone instead of his Android?
  3. How do we “know” it really is Donald Trump tweeting any of this?

I recognize these, am ignoring them and still find this script/bot useful for now.

Can You Post the Code?

Of course. The code is at https://github.com/WebBreacher/twitterretweeterbot for your downloading, usage and improvement.

Pieces of the script:

  1. You must have a Twitter app created and accessible API keys (they are free).
  2. Place those in the creds.py file.
  3. Put all the code on a system that has Python and the Tweepy module (You can most likely pip install tweepy if you do not have it on your system.)
  4. Run the script.
  5. It will create a file in /tmp/trumpbot_lasttweet with the number of the last tweet it analyzed.
  6. I’ve added it to my “cron” (scheduled tasks) on a linux server so that it runs every 2 minutes.

Updated – 2016-12-15

I just noticed that, if the original tweeter deletes their original tweet then IsItTrump’s retweet shows the below content:

capture

We can’t have our retweets disappearing now can we? So, I took the suggestion of @Mubix to make a screenshot of the original tweet and tweet a pic of the original instead of retweeting a tweet. I used @lanmaster53‘s Peepingtom project to get how to call the phantomjs file right (to get the screenshot). Now the tweets from @IsItTrump look like the image below with the original content preserved!

2016-12-15_220159

Update – 2017-05-29

Since Trump started using an iPhone for his tweeting several months after his inauguration, this bot was less helpful as a discriminator to help people figure out “was it Trump that tweeted or his staff?” But it remains helpful as an archive of his tweets and the first reply that was tweeted to those tweets. I’ve found that these “replies” to Trump are sometimes more interesting than his original tweet! Here is an example of what the bot’s tweets look like now:

Capture

Update – 2017-06-10

Some people mentioned that other Trump administration and family accounts were blocking people from seeing their tweets. They asked if I could mod IsItTrump to get their feed and display pics of their tweets too. Yes. Yes I can. And so, as of now, the IsItTrump bot takes a screenshot and then tweets a pic of:

  1. Donald Trump
  2. Donald Trump Jr.
  3. Eric Trump
  4. Dan Scavino
  5. Michael Cohen

Let me know if I should be adding others to this list.

Final update – 2019-08-01

Well, it was a good run and a fun project. Somehow the Twitter account(s) I was using for this (@IsItTrump) were flagged for Terms Of Service violations on Twitter. No word on what those were just a brief note saying your account is dead.

With that, I’m shutting down the project. It was interesting and allowed me to learn so I call it a success.

If you still want to analyze Trump’s (or anyone’s) tweets, I recommend:

Thanks for reading and stay OSINTCurious!

Comments are closed.

Up ↑