added hashtag exclusion list

master
Domeniko Gentner 4 years ago
parent 250abb3837
commit a4c463c12d
  1. 5
      twitter/twitter.py

@ -22,7 +22,7 @@ class twitter:
self.credentials = str() self.credentials = str()
if system().lower() == "windows": if system().lower() == "windows":
self.path = Path("bearer.json") self.path = Path("twitter.json")
else: else:
self.path = Path("/etc/tw2hugo/twitter.json") self.path = Path("/etc/tw2hugo/twitter.json")
@ -51,6 +51,9 @@ class twitter:
r = requests.get(url=get_url, headers=header) r = requests.get(url=get_url, headers=header)
r.raise_for_status() r.raise_for_status()
excluded = r.json()[0]['entities']['hashtags'][0]['text']
if excluded in self.credentials['exclude']:
exit(0)
return r.json()[0] return r.json()[0]
except Exception as e: except Exception as e:

Loading…
Cancel
Save