-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.py
70 lines (50 loc) · 2.1 KB
/
source.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pip install tweepy
import tweepy as twitter
import datetime
import time
auth = twitter.OAuthHandler(api_key, api_secret_key)
auth.set_access_token(access_token, access_token_secret)
api=twitter.API(auth,wait_on_rate_limit=True)
ids=[]
tweets=[]
def bot(*hashtag):
global unique_count
unique_count=0
global duplicate_count
duplicate_count=0
print(datetime.datetime.now())
for tweet in twitter.Cursor(api.search, q=hashtag, lang="en", rpp=20).items(30):
id = dict(tweet._json)['id']
ids.append(id)
text=dict(tweet._json)['text']
tweets.append(text)
#print(tweet)
while True:
try:
api.update_status(status = 'Kindly Check https://covidwin.in/, https://life.coronasafe.network/, https://indiacovidresources.in/, https://covidfightclub.org/, https://covidrelief.glideapp.io/, https://external.sprinklr.com/insights/explorer/dashboard/, https://covid19-twitter.in/, https://covidtools.in/, https://covid.army/'+str(count),
in_reply_to_status_id = id, auto_populate_reply_metadata=True)
api.retweet(id)
#api.create_favourite(id)
print("Tweet ID:",id)
print("Tweet Text:",text)
unique_count = unique_count+1
#ids.append(id)
except twitter.TweepError as e:
print(e.reason)
#print("Tweet Text:",text)
print("Already retweeted and replied to this tweet !! Bot re-executing\n")
duplicate_count = duplicate_count+1
break
print("Let the tweepy rest !! \n")
time.sleep(3)
#bot('#oxygenneeded')
#bot('#कोविड१९भारतसेवा')
#bot('#oxygenneeded')
#bot('#UrgentHelp')
bot('#ICUBeds')
#bot('#COVIDEmergency')
#bot('#COVIDEmergencyIndia')
#bot('#Covid19IndiaHelp')
print("Total ids :",len(ids),"\nTotal Set ids :",len(set(ids)))
print("Total Tweets :",len(tweets),"\nTotal Set Tweets :",len(set(tweets)))
print("Unique iterations: ",unique_count,"\nDuplicate iterations: ",duplicate_count)