repaired tweet logic

master
Domeniko Gentner 4 years ago
parent f1bbd262e7
commit 168d0ff42f
  1. 11
      twitter/twitter.py

@ -55,10 +55,9 @@ class twitter:
# Get hashtag list # Get hashtag list
tweet_tags = r.json()[0]['entities']['hashtags'] tweet_tags = r.json()[0]['entities']['hashtags']
hashtags = self.credentials['hashtags'] hashtags = self.credentials['hashtags']
found_not_allowed_tag = False found_not_allowed_tag = True
for each in tweet_tags: for each in tweet_tags:
# print(each)
# It's a blocklist and the hashtag is found # It's a blocklist and the hashtag is found
if self.credentials['is_blocklist'] and each['text'] in hashtags: if self.credentials['is_blocklist'] and each['text'] in hashtags:
found_not_allowed_tag = True found_not_allowed_tag = True
@ -69,11 +68,15 @@ class twitter:
found_not_allowed_tag = False found_not_allowed_tag = False
break break
if self.credentials['omit_replies'] and r.json()[0]['in_reply_to_status_id']: # it is a list of allowed hashtags and the hash was not fonud
# Tweet is a reply if not self.credentials['is_blocklist'] and not each['text'] in hashtags:
found_not_allowed_tag = True found_not_allowed_tag = True
break break
# Is Tweet a reply?
if self.credentials['omit_replies'] and r.json()[0]['in_reply_to_status_id']:
found_not_allowed_tag = True
if found_not_allowed_tag: if found_not_allowed_tag:
exit(0) exit(0)

Loading…
Cancel
Save