check more pages
This commit is contained in:
parent
d1390d73b8
commit
897c0f8ef5
27
main.py
27
main.py
@ -122,19 +122,20 @@ async def check_updates():
|
|||||||
for tl_idx in range(0, len(tag_list), 40):
|
for tl_idx in range(0, len(tag_list), 40):
|
||||||
tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + 40])
|
tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + 40])
|
||||||
logging.warning(tags)
|
logging.warning(tags)
|
||||||
posts = await e621.get_posts(tags)
|
for page in range(1, 11):
|
||||||
if not posts:
|
posts = await e621.get_posts(tags, page)
|
||||||
return
|
if not posts:
|
||||||
already_sent: List = await redis.smismember('e621:sent', [p.id for p in posts])
|
return
|
||||||
# last_index = len(posts)
|
already_sent: List = await redis.smismember('e621:sent', [p.id for p in posts])
|
||||||
# if already_sent.count(True):
|
# last_index = len(posts)
|
||||||
# last_index = already_sent.index(True)
|
# if already_sent.count(True):
|
||||||
# await redis.sadd('e621:sent', *[posts[i].id for i in range(last_index, len(posts))])
|
# last_index = already_sent.index(True)
|
||||||
for i in list(range(len(posts)))[::-1]:
|
# await redis.sadd('e621:sent', *[posts[i].id for i in range(last_index, len(posts))])
|
||||||
if already_sent[i]:
|
for i in list(range(len(posts)))[::-1]:
|
||||||
continue
|
if already_sent[i]:
|
||||||
await send_post(posts[i], tag_list)
|
continue
|
||||||
await sleep(1)
|
await send_post(posts[i], tag_list)
|
||||||
|
await sleep(1)
|
||||||
|
|
||||||
|
|
||||||
@dp.message(filters.Command('add'), ChatFilter)
|
@dp.message(filters.Command('add'), ChatFilter)
|
||||||
|
Loading…
Reference in New Issue
Block a user