Commit 853e546d authored by andytnt's avatar andytnt

Fix Target profile infos are scraped at each round

parent 5794bc49
...@@ -123,7 +123,7 @@ async def Tweet(url, config, conn): ...@@ -123,7 +123,7 @@ async def Tweet(url, config, conn):
except Exception as e: except Exception as e:
print(str(e) + " [x] get.Tweet") print(str(e) + " [x] get.Tweet")
async def User(url, config, conn): async def User(url, config, conn, user_id = False):
#loggin.info("[<] " + str(datetime.now()) + ':: get+User') #loggin.info("[<] " + str(datetime.now()) + ':: get+User')
try: try:
response = await Request(url) response = await Request(url)
...@@ -132,6 +132,9 @@ async def User(url, config, conn): ...@@ -132,6 +132,9 @@ async def User(url, config, conn):
except Exception as e: except Exception as e:
print(str(e) + " [x] get.User") print(str(e) + " [x] get.User")
if user_id:
return int(inf(soup, "id"))
def Limit(Limit, count): def Limit(Limit, count):
#loggin.info("[<] " + str(datetime.now()) + ':: get+Limit') #loggin.info("[<] " + str(datetime.now()) + ':: get+Limit')
if Limit is not None and count >= int(Limit): if Limit is not None and count >= int(Limit):
......
...@@ -105,7 +105,8 @@ class Twint: ...@@ -105,7 +105,8 @@ class Twint:
self.config.Username = await get.Username(self.config.User_id) self.config.Username = await get.Username(self.config.User_id)
if self.config.Username is not None: if self.config.Username is not None:
self.config.User_id = await get.UserId(self.config.Username) url = f"http://twitter.com/{self.config.Username}?lang=en"
self.config.User_id = await get.User(url, self.config, self.conn, True)
if self.config.TwitterSearch and self.config.Since and self.config.Until: if self.config.TwitterSearch and self.config.Since and self.config.Until:
_days = timedelta(days=int(self.config.Timedelta)) _days = timedelta(days=int(self.config.Timedelta))
...@@ -126,8 +127,6 @@ class Twint: ...@@ -126,8 +127,6 @@ class Twint:
while True: while True:
if len(self.feed) > 0: if len(self.feed) > 0:
if self.config.Followers or self.config.Following: if self.config.Followers or self.config.Following:
url = f"http://twitter.com/{self.config.Username}?lang=en"
await get.User(url, self.config, self.conn)
await self.follow() await self.follow()
elif self.config.Favorites: elif self.config.Favorites:
await self.favorite() await self.favorite()
......
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