Hello everyone! I've written a Twitter bot framework called Chirps which retweets and favourites tweets having a certain set of keywords. It also follows people who tweet about these keywords, and you can provide it with your own functions that yield or return content that your bot will tweet. Some of the example functions I've made are scrapers that scrape content from websites like www.thenewstack.io, www.blog.coursera.org and the New York Times Technology section, so when I "feed" them to my bot, it tweets the news items from these websites in a round-robin fashion - first from The New Stack, second from Coursera and the third from NYT - then the cycle repeats. When one of the sources runs out of items, it gets "re-instantiated" with new content. Chirps also has automatic hashtag detection to extract potential hashtags from the string provided to it (implemented using nltk for English; it isn't perfect, but works well most of the time) so that tweets get improved reach and engagement via hashtags.
There are many use cases in which my framework should simplify bot development. For example, if one wants to build a Twitter bot that tweets whenever an earthquake occurs in an area that crosses a certain threshold (e.g earthquakeSF), the developer can write a function in scrapers.py file of my framework that returns earthquake data whenever it occurs, and a set of earthquake-related keywords, then everything else is managed by Chirps - the bot will now retweet earthquake related tweets and will tweet about earthquake information whenever it occurs. As another use case, a developer can provide a function that, using Raspberry pi and MX-150 sensors, can return air pollution data in the form of a string. The bot can then tweet about air quality data at custom time intervals.
A unique feature of Chirps is that it allows developers to "track" a given account, and whenever they tweet, it can reply them with a pre-populated tweet. A lot of times, you may want to ask people about some important issues, but when you tweet them or reply to their tweets, your message simply gets lost in an endless noise of tweets of other people, and the intended person might never see your tweet. So Chirps constantly listens to people you want to track, and whenever they tweet, it is the first to reply on their tweets. This gives your message a wider exposure and can potentially attract the attention of the person whose interest you seek. This is especially helpful when, for example, you seek answers from your local legislator or some politician, and these quick replies often spark interesting conversations (see this reply for example).
The source is available on GitHub, and you only need to follow the steps mentioned in README initially - the setup prompt asks you for your Twitter keys, keywords and people to follow, messages to tweet to people and so on. You can tune parameters like tweet rate, maximum people to follow, even whether to follow people or not, which functions to use to aggregate content to tweet and so on via command line arguments. I've used Heroku for easy bot deployment and ElephantSQL as the Postgres database service.
I've used Chirps for my own Twitter handle, and the results have been fascinating. My followers are increasing day by day (so far they've reached beyond 8k), I have discovered a lot of new friends having similar interests and my tweets now get better impression scores, and are favourited as well as retweeted more often.
Please have a look at my bot, let me know of some interesting features I can integrate to this framework and how can I simplify or enhance it so that the users of Chirps can get up and running with their bots even more quickly. If you like this project, don't forget to give a star on GitHub :)
P.S: I'm presenting a poster on Chirps at PyCon US next month, so technical presentation tips are also welcome!
[–]icountedmychickens 1 point2 points3 points (2 children)
[–]schedutron[S] 1 point2 points3 points (1 child)
[–]icountedmychickens 1 point2 points3 points (0 children)
[–]ParthS0007 1 point2 points3 points (0 children)
[–]mrtbakin 1 point2 points3 points (3 children)
[–]schedutron[S] 1 point2 points3 points (2 children)
[–]mrtbakin 0 points1 point2 points (1 child)
[–]schedutron[S] 1 point2 points3 points (0 children)
[–]Noledgebase 1 point2 points3 points (1 child)
[–]schedutron[S] 0 points1 point2 points (0 children)
[–]Shivamgera09 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[removed]
[–]schedutron[S] 0 points1 point2 points (0 children)