Quotebot,a clever twitter bot powered by Python

A person creating twitter bot and passing some orders to it.


We can do everything these days with the help of computing.We can automate,we can play with web,we can do anything.The main concern is collecting the different pieces of thoughts and combining them into an Idea.The thing I did is something crazy,but not senseless.

What is twitter bot?

Twitter bot is a program that posts to the twitter page autonomously without the intervention of a human operator.Once the bot is initiated,nobody concerns about  it,because bot itself can see its job from that moment.

Quotebot,story begins!

I created a twitter bot called Quotebot which posts quotes on a twitter page daily.There are lot’s of bots out there to do different things.In this post I am showcasing my twitter bot which is totally written in python.My major thought was to post a quotation daily,but according to the day, category of the quotations should change.

In the beginning i don’t have a single quote data  with me.Instantly i wrote a spider in the powerful framework,dragline and collected nearly 93000 of quotes from different catagories within few minutes.Below is my robomongo snapshot,I created 31 categories since a month has at most 31 days.


Now i have the data source to publish.but quotes can have varying length.Twitter will not allow me to post message length greater than 140 characters.I depressed,because I collected the data,but twitter is limiting me.Then one thing came to my mind.

Twitter allows us to upload media,i.e image files.So  converting those quotes into images and then uploading them to the twitter works out.

I used tweepy,a well known twitter handling python library for dealing with updating status,used Img4me API for converting the quotes into images.The main characteristics given to Quotebot are outlined below:

1)  It posts 120 posts at max daily,one post per every 5 minutes.

2) Only posts quotes according to the day in a month,each day in a month is classified as love day,science day,inspiration day.

Quotebot only posts the corresponding posts on a particular day.

3) Each quote that fetched from the database to post is automatically converted into image and then uploaded to the twitter page

4) Logs the posting time and all the network transactions.

5) No conflicts between data posted and to post data,since bot uses Redis data store for controlling the post integrity.

6) Quotebot wakes up when system is booted up,and posts 120 posts and then goes to sleep.

Technologies used in building Quotebot

1) Tweepy library & Python

2) Redis

3) MongoDB

4)Image4me.com API

Here is the screenshot of the page on which twitter bot is running

I think you are interested how things are going in the back. Tweepy is the straight forward tool for working with twitter. Posting,retweeting,deleting tweets,make friends,remove friends,follow pages everything can be done by the tweepy.Once tweak it if you are interested.link is this. http://tweepy.readthedocs.org/en/v2.3.0/getting_started.html#introduction

Where is the code for Qoutebot?

Because it is not good  of telling a thing and messing up post with code same time,I am not describing the entire procedure here.But entire fully functional code for the Quotebot is located open at my github repository.Feel free to explore the code.


Hey where is that twitter page link,you just kept one screenshot?

The Quotebot functionality is 100% authentic.I posted this to show how we can automate things with help of computing power,that too with sweet language Python and light speed Redis.The spider part is only for fetching data from the well known website and store quotes in MongoDB. Here is link for that twitter page bot is operating on.

Explore the code.Enjoy the thought.You can also view my other repositories on github.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s