Commit bcbd8f49 authored by Francesco Poldi's avatar Francesco Poldi

Added deep log for requests

parent a658326a
...@@ -23,6 +23,7 @@ class Twint: ...@@ -23,6 +23,7 @@ class Twint:
self.count = 0 self.count = 0
self.consecutive_errors_count = 0 self.consecutive_errors_count = 0
self.has_more_items = True self.has_more_items = True
self._has_more_items = True
self.user_agent = "" self.user_agent = ""
self.config = config self.config = config
self.conn = db.Conn(config.Database) self.conn = db.Conn(config.Database)
...@@ -51,6 +52,8 @@ class Twint: ...@@ -51,6 +52,8 @@ class Twint:
if self.config.Debug: if self.config.Debug:
print(response, file=open("twint-last-request.log", "w", encoding="utf-8")) print(response, file=open("twint-last-request.log", "w", encoding="utf-8"))
print(f"had_more_items:{self._has_more_items};has_more_items:{self.has_more_items};init:{self.init};len_feed:{len(self.feed)}",
file=open("twint-requests-deep.csv", 'a'))
if self.config.Resume: if self.config.Resume:
print(self.init, file=open(self.config.Resume, "w", encoding="utf-8")) print(self.init, file=open(self.config.Resume, "w", encoding="utf-8"))
...@@ -70,10 +73,10 @@ class Twint: ...@@ -70,10 +73,10 @@ class Twint:
else: else:
self.feed, self.init = feed.profile(response) self.feed, self.init = feed.profile(response)
elif self.config.TwitterSearch: elif self.config.TwitterSearch:
self.feed, self.init, _has_more_items = feed.Json(response) self.feed, self.init, self._has_more_items = feed.Json(response)
if (not self.feed) and self.has_more_items: if (not self.feed) and self.has_more_items:
await self.Feed() await self.Feed()
self.has_more_items = _has_more_items self.has_more_items = self._has_more_items
return return
except TimeoutError as e: except TimeoutError as e:
if self.config.Proxy_host.lower() == "tor": if self.config.Proxy_host.lower() == "tor":
......
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