added hashtag exclusion list

This commit is contained in:
Domeniko Gentner 2020-11-08 14:23:05 +01:00
parent 250abb3837
commit a4c463c12d

View File

@ -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: