A Python built twitter retweet bot using Tweepy. Searches and retweets based on hashtag or keyword. Can do for multiple keywords, or hashtags. It can be used for automation and marketing purposes.
-
Tweepy - An easy-to-use Python library for accessing the Twitter API.
pip install tweepy
-
Make a Twitter Developer Account.
-
Make sure you fully understand Twitter's Rules on Automation. Play nice. Don't spam!
-
And you need to have Heroku Account.
-
Create a new directory to contain all of your retweet bot files.
mkdir retweet-bot
-
Follow all the steps as shown in this YouTube Video
-
Create a new Twitter Application. This is where you'll generate your keys, tokens, and secrets.
-
Fill in your keys, tokens, and secrets in the credentials.py file.
-
Check comments in bot.py to tweak the retweet bot to your liking.
-
The example demonstrates a single hashtag value, but you can tweak the code to search multiple hashtags. Example:
q= #nifty50 OR #sensex
-
Run your bot.py script.
python bot.py
-
If it runs without any errors it can be deployed on Heroku.
-
Once deployment is done you're good to go you !Sit back and relax have successfully created a twitter bot.:sunglasses:
You need to make three differnt files :
- runtime.txt (Includes Python Version
python-3.8.1
) - requirements.txt (
pip freeze > requirements.txt
) - Procfile (
worker: python bot.py
)
- Note: Make sure that your bot.py and credentials.py files are, obviously, in the same directory.
- If you are stuck any where you can contact me via Twitter or LinkedIn I will be glad to help you.:blush:
- And you must checkout my another twitter bot which shares information related to Machine Learning.