TweeBot @TweeBot22
Built in Python
- First of all create a Twitter Developer account
https://developer.twitter.com/en
. - Then create an app which will provide you with Consumer API keys and Access keys in the keys and token section.
- For Weather API, go to
https://openweathermap.org/
and obtain the API keys. - Check your Python version in terminal/command line using
python --version
orpython3 --version
. - You can also use pythonanywhere.com and host the python script so that it works even if you shut down your computer. Needs to be refreshed every 7-8 hours if using the free account.
- Tweepy Used to access the Twitter API
pip install tweepy
. - Pyowm Used to access the Weather API
pip install pyowm
. - Requests Used for HTTP requests (web scraping)
pip install requests
. Usepip3
ifpip
does not work.
Create a
last_seen_id.txt
file in the same directory where the code is which will store the last seen tweet's id. Add the id for the first time manually.
Or use the one in the repo, no need to change the id for starters, the code will automatically update.
- When a user mentions the bot and uses the #helloworld hashtag, the bot likes the tweet, retweets and follows the user.
- This is done using the functions available in Tweepy.
- When a user mentions and uses the #weatherupdate hashtag, the bot will like, retweet and follow the user if not followed already and tweet a weather update. Each weather status has an emoticon assigned to it.
- When a user mentions and uses the #newsupdate hashtag, the bot will like, retweet and follow the user if not followed already and tweet the 8-12 top live news each in a separate tweet.
- This is done using the
newsapi.org
API and HTTP requests. The website has various sources from which user can scrape the top live news.
- This is done using the
- When a user mentions and uses the #covidupdate hashtag, the bot tweets the COVID-19 stats of India.
- This is done by scraping the information from
https://www.worldometers.info/coronavirus/country/india/
.
- This is done by scraping the information from
To get started... 👨🏻💻
-
Option 1
- 🍴 Fork this repo!
-
Option 2
- 👯 Clone this repo to your local machine using
https://github.com/Kanishk-Srivastava/TweeBot.git
- 👯 Clone this repo to your local machine using
- HACK AWAY! 🔨🔨🔨
- 🔃 Create a new pull request using
https://github.com/Kanishk-Srivastava/TweeBot/compare/
.
Reach out to me at one of the following places! ✌🏼
- Twitter at
@Kanishk2209
- Connect with me on LinkedIn
Kanishk Srivastava