fixed unrecognisable lang bug

This commit is contained in:
Robert Nasarek 2023-01-31 17:51:06 +01:00
parent 2b98565444
commit 79f54079f7
2 changed files with 5 additions and 2 deletions

View file

@ -31,7 +31,10 @@ class TootCrawler():
timelinePagination = self.mastodonInstance.fetch_previous(timelinePagination)
for i in allTimelineResults:
content = self.cleanhtml(i.content)
language = detect(content)
try:
language = detect(content)
except:
language = None
sentiment = self.sentiTooter.analyze(language, content)
toot = {
"sentiment": sentiment[0],