Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit ecdd219

Browse files
Merge pull request #452 from amoghak-ds/patch-2
Update README.md
2 parents 5d5745a + e45857e commit ecdd219

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

projects/Twitter-Bot/README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
## Twitter-RT-Bot
1+
## TWITTER-BOT
22

3-
> **Note**
4-
5-
install **tweepy** library before jumping on the code :
3+
This basic python project involves creating a Twitter bot using Tweepy to retweet tweets that contain certain hashtags related to Python and programming.
4+
Well, before that you might need to install:
65
```bash
76
pip install tweepy
87
```
8+
This file includes the detailed and concise explanation of the project code as follows:
9+
10+
1. Created a "MyStreamListener" class that inherits from "tweepy.StreamListener". This class defines how the bot should behave when it receives tweets.
11+
12+
2. In the "on_status" method of "MyStreamListener", it checks if the tweet is not a retweet and not a reply before retweeting. This ensures that you only retweet original tweets and not replies or retweets.
13+
14+
3. In the "on_error" method of "MyStreamListener", it handles error code 420 (rate limit exceeded) by printing a message and returning False to stop the stream.
915

10-
Make sure to get your required APIs from Twitter Developers website. It's extremely easy to set up your developer account ang get the APIs for those who haven't yet came across.
16+
4. Used the "myStream.filter" method to filter tweets with the specified keywords and language ("en" for English).
1117

12-
This Bot Retweets the Tweets which come on the feed in real-time, you may add different functionalities to your Bot according to your requirements.
18+
5. Make sure to replace "enter your API key here", "enter your API secret key here", "enter your access token here", and "enter your access token secret here" with your actual Twitter API credentials.
1319

14-
By this code You will be able to make a bot which retweet the tweets with information you want it to give.
20+
## Note: Remember that running a Twitter bot should comply with Twitter's terms of service and automation rules. Be cautious not to exceed rate limits or engage in spammy behavior.
1521

1622

0 commit comments

Comments
 (0)