[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-07-06 14:30:27 +03:00
parent 75f41b03db
commit 858332d657

@ -57,6 +57,8 @@ async def tiktok_videos_links_get(
r'https://www.tiktok.com/@\w+/video/\d+'
).findall(content)
old_size = len(links)
for o in new_links:
links.add(o)
@ -69,10 +71,11 @@ async def tiktok_videos_links_get(
if elapsed > max_time:
break;
logger.info(json.dumps(dict(
total=len(links),
elapsed=elapsed,
scroll_y=await session.page.evaluate('window.scrollY'),
)))
if old_size < len(links):
logger.info(json.dumps(dict(
total=len(links),
elapsed=elapsed,
scroll_y=await session.page.evaluate('window.scrollY'),
)))
return links