As the situation in India is not good for getting medical facilities and resources so Shri shares the top websites where all resources are updated from time to time by retweeting and replying them.
👇 Click on this icon to meet Shri:
Before using the script, make sure to install the required library:
pip install tweepy
To get started, you'll need to set up your Twitter API keys. Head over to the Twitter Developer portal to obtain your
- api_key,
- api_secret_key,
- access_token, and
- access_token_secret.
Replace the placeholders in the script with your actual API keys.
Execute the script to start fetching tweets with specific hashtags. Here's an example using the #ICUBeds hashtag:
bot('#ICUBeds')
The bot function takes one or more hashtags as arguments and searches for tweets containing these hashtags. It retrieves 30 tweets (can be adjusted by changing rpp=20
). For each tweet, it extracts the tweet ID and text.
The script attempts to retweet and reply to each fetched tweet with essential COVID-19 resource links. If a tweet has already been retweeted, the script catches the exception and continues to the next tweet, but this was not the case with early tweets where it spammed replies
The reply includes links to prominent COVID-19 resource websites in India.
To comply with Twitter API rate limits, the script pauses for 3 seconds after processing each set of tweets.
The script is demonstrated using the #ICUBeds hashtag, but you can use other relevant hashtags for different resource categories that are trending on Twitter like '#COVIDEmergency', '#COVIDEmergencyIndia', '#Covid19IndiaHelp', '#oxygenneeded', '#कोविड१९भारतसेवा', '#oxygenneeded','#UrgentHelp'.
After execution, the script prints the total number of unique and duplicate tweet IDs and texts.