Tweet imitator by Python

Currently I am reaching the end of my summer internship, and the company is in the social media marketing area. Basically it has dozens of social media accounts that can be used to reply to real users’ tweets about a specific topic, let’s say, a sports event, and in the replies would the robots attach links that are connected to some websites with promotional offers. Therefore, it is a good way to enhance the website traffic and do advertisements because it is not as annoying as sending you spam emails or phone calls, but to do that, we need really really authentic and sound robot accounts.
Screen-Shot-2016-07-21-at-4.48.28-PM.pngThat’s when difficulties kicked in. For example on Twitter, during the summer, my teammate and I have tried manually operating several accounts, by tweeting out posts, retweeting and all the stuff that normal users would do. However, it soon became a nightmare to operate even just 2 accounts at the same time since I felt like a psycho all the time, splitting up my life into different segments.

That feeling sucked, and I decided to research on the behaviour of robot accounts that mimicked real users. It soon got rewarding because I realized all robots follow a pattern, in which there’s a particular topic, such as fashion, food, sports or politics. They all seem to have at least one very outstanding characteristic.

Alright, since they all follow patterns in what they are tweeting about, why can’t I automate the pattern. The thought is, for example, if I am a foodie, I would often tweet about foods, and I will follow a lot of foodies’ accounts. If that is the case, I can design a program that randomizes the tweeting by using A-Basket-Of-Users method. What the hell is that? Well, it is just like how the currency policy works, by monitoring a bunch of important sources actively, but eventually it will finalize on one specific tweet to send out.

Yeah, I know it also sucks if I don’t know what I am going to send out, because there should be a way to graphically show what’s the outcome of the process, so I made a user-interface-version of it.
IMG_4332.JPGI can type in the account name I want to imitate, and it will send out that tweet using my account. If the tweet is over 140 character limit, it can also automatically truncate out unneeded url links in the latter part. Each time I hit the “upgrade” button, it will generate a new randomized tweet from the queried user, so hopefully nobody finds out who I am imitating if the “basket” is big enough.

For the server version, I also added in the “retweet” function since it is the most-used feature for those robot accounts, as they always retweet what they like. A potential timer module can be added to run this program 24/7 but I was, to be honest, too lazy to do that LOL.

I put my code open-source on my Github, because it is too long to show here in my blog post, and I value readability very much. Also, thanks to sixohsix’s gorgeous twitter API module in python.

P.S. Every experiment comes with punishments.
JPEG-image-AF43E2786D29-1.jpeg

Leave a Reply

Your email address will not be published. Required fields are marked *