-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4826e7d
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# TwitterBot | ||
This is the simplest twitter bot for retweet. | ||
|
||
## Dependencies | ||
**```tweepy```**<br> | ||
install via pip<br> | ||
```sudo pip install tweepy``` | ||
|
||
## How to use | ||
1. First create App on twitter.<br> | ||
Visit: http://apps.twitter.com <br> | ||
**You need a twiter account for this.** | ||
|
||
2. Generate **consumer_key, consumer_secret, access_token, access_token_secret**. | ||
3. Download ```retweet.py``` form my repository. | ||
4. Now exit ```retweet.py``` and enter your **consumer_key, consumer_secret, access_token, access_token_secret** in this script. | ||
5. Finally run **retweet.py** | ||
|
||
## How to edit ```retweet.py``` | ||
You can increase ```hash_tag``` in **hast_tag** for retweets.<br> | ||
Example: <br> | ||
hash_tag = ['exmaple']<br> | ||
edit: <br> | ||
hash_tag = ['example','example2']<br> | ||
Now ```for``` loop will automatically itrate ```hash_tag``` | ||
|
||
|
||
|
||
|
||
### Please commit for any changes or bugs :) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
import tweepy | ||
import time | ||
|
||
consumer_key = '8ROBF6oXfqKojxSGSPQn9bjBC' | ||
consumer_secret = 'TG8IZiVVsWkAvAW0IuWi7UvQVP4Spkmdh4NawVxpReJQzUfrcM' | ||
access_token = '3241977882-vC0oeIcjrBIU7oRjWLxy3hU35ntsuU7XNBPXWQN' | ||
access_token_secret = 'Xkyzls3T0rD2T5l67o3hMfyQkGWFRzgZYH9Wnkp92m7iO' | ||
|
||
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | ||
auth.set_access_token(access_token, access_token_secret) | ||
api = tweepy.API(auth) | ||
|
||
hash_tags = ['#IIT_indore','#not_so_prestigious','#bhookhLagiHai '] | ||
|
||
for query in hash_tags: | ||
for tweet in tweepy.Cursor(api.search, q=query).items(5): | ||
try: | ||
print('\nTweet by @' + tweet.user.screen_name) | ||
print('Attempting to retweet') | ||
|
||
tweet.retweet() | ||
print('Retweet published successfully.') | ||
time.sleep(10) | ||
except tweepy.TweepError as error: | ||
print('\nError. Retweet not successful. Reason: ') | ||
print(error.reason) | ||
except StopIteration: | ||
break |