After twitter banned @therealdonaldtrump, the American president went on to tweet from different twitter accounts related to the Trump campaign. Apparently, his media manager - Gary Coby (@garycoby) - offered President trump his own account. Twitter noticed and swiftly banned @garycoby as well.
I believe that the Trump campaign will have learnt from that event. So now, if ex-President Trump wishes to use someone else's account secretly, they won't announce it, so that they can post undettered.
So who's to say that your new friend isn't actually Donald Trump?
While he can change his profile details, we can assume that his tweets will remain somewhat similar! Humans are, after all, creatures of habit. So how can we figure out if your friend is secretly Donald Trump?
Simple!
We will see your friend's (or any public account's) recent tweets! And if they're similar to what DJT would have posted, I have some bad news for you :( We will be using the Levenshtein algorithm to compare your friends tweets to all of DJT's tweets over the past 6 months!
Simply run the program (assuming you have Twitter's API keys) python3 trumpdetection.py
and enter your suspect's username :)
In my code, I've imported a custom module called twitterauthentication.py
. In that module, I have listed out the Twitter API keys. You will need to get your own API keys to use this. You can learn how to do that very easily here (Note that this page also shows how to connect to the API. However, the code in trumpdetection.py
already accounts for that through the use of the tweepy module). Alternatively, you can explore the twitter api and the tweepy module in greater depth with this great instructional video
# The twitterauthentication.py file is written as below.
# Listing the file under .gitignore ensures that you don't accidentally reveal your API keys if you push it online.
appAPIKey = "XXXXXXXXXXXXX"
appAPIKeySecret = "XXXXXXXXXXXXX"
appBearer = "XXXXXXXXXXXXX"
appAccess = "XXXXXXXXXXXXX"
appAccessSecret = "XXXXXXXXXXXXX"