-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
56 lines (43 loc) · 1.66 KB
/
main.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
import tweepy
from time import sleep
from json import loads
from requests import get
from key import *
REMAP_TIME , ERROR_TIME = int(125), int(5)
auth = tweepy.OAuthHandler(API_KEY,API_SECRET)
auth.set_access_token(ACCESS_TOKEN,ACCESS_SECRET)
API = tweepy.API(auth, wait_on_rate_limit = True)
COUNT,POST_ERROR,FAKE = int(0),int(0),int(0)
def tweeter():
global COUNT
global POST_ERROR
global FAKE
tag = "#catsoftwitter"
nrTweets = int(50)
for status in tweepy.Cursor(API.search_tweets, tag,tweet_mode="extended",lang="en").items(nrTweets):
if "whatsapp" in status.full_text.lower() : # blocks whatsapp
FAKE+=1
elif "buy" in status.full_text.lower(): #blocks buy
FAKE+=1
elif "know more" in status.full_text.lower(): #blocks knowmore
FAKE+=1
elif "#crypto" in status.full_text.lower(): #blocks $
FAKE+=1
elif "#nft" in status.full_text.lower(): #blocks nft
FAKE+=1
else:
try:
status.retweet()
#status.favorite()
COUNT +=1
print("Latest TIME = %d ; POSTS = %d ; ERROR = %d ; FAKE = %d "%(REMAP_TIME,COUNT,POST_ERROR,FAKE))
sleep(REMAP_TIME)
except Exception as e:
POST_ERROR +=1
print("ERROR:POSTS = %d ; ERROR = %d ; FAKE = %d %s"%(COUNT,POST_ERROR,FAKE,e))
sleep(ERROR_TIME)
tweeter()
tweeter()
#code finalized, updated on 12/march/2022
#@HasanIntrovert, signed in with google public id
#continued minor bug fixes