I just set up a Twitter Bot to retweet #Nanded OR #नांदेड, so the folks from Nanded can trace on a single Twitter handle about the tweets related to their beloved city and also this bot posts latest news on the handle from the news site. I ended up piecing together concepts from a couple different tutorials in order to do this.
Prerequisite: Python, REST APIs, Git, environment variables.
Steps to build and deploy the bot:
1. Clone or download the repository from https://github.com/pritcool2003/nandediansbot
2. Create a Twitter account, set up an application under it and note the tokens
3. Move to the nandediansbot folder on the desktop
4. Place the tokens in credentials.py file
5. Open the nandediansbot.py file and change the desired parameters, if you want to remove posting news remove the
Post_news function and also delete the news.py file (like no to retweets, hashtags)
6. If you wish to add or change news sites open news.py to the needed changes (optional)
7. The requirements.txt consists of required packages
8. Procfile specifies the commands that are executed by the app on startup (Heroku)
9. Now create a heroku account
10. Follow the steps provided on heroku for deploying a python application
Disclaimer: The bot is only for educational purpose, the news scrapped are from publically available data on the respective news sites.
Do check the twitter polices on automation before deploying.