Commit 685078ff authored by Maxim Gubin's avatar Maxim Gubin Committed by Francesco Poldi

Fix unexpected stops due to empty response (#254)

parent 2c0bbde6
......@@ -38,6 +38,8 @@ class Twint:
print(response, file=open("twint-last-request.log", "w", encoding="utf-8"))
self.feed = []
consecutive_errors_count = 0
while True:
try:
if self.config.Favorites:
self.feed, self.init = feed.Mobile(response)
......@@ -50,8 +52,13 @@ class Twint:
self.feed, self.init = feed.profile(response)
elif self.config.TwitterSearch:
self.feed, self.init = feed.Json(response)
break
except Exception as e:
# Exit only we're 3 times sure it is the end of the road
consecutive_errors_count += 1
if consecutive_errors_count < 3: continue
print(str(e) + " [x] run.Feed")
break
async def follow(self):
#logging.info("[<] " + str(datetime.now()) + ':: run+Twint+follow')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment