From 897c0f8ef510af7a45071380cb8a31d38dbe403f Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Fri, 27 Oct 2023 18:27:36 +0300 Subject: [PATCH] check more pages --- main.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index ec0c52a..0ef90ad 100644 --- a/main.py +++ b/main.py @@ -122,19 +122,20 @@ async def check_updates(): for tl_idx in range(0, len(tag_list), 40): tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + 40]) logging.warning(tags) - posts = await e621.get_posts(tags) - if not posts: - return - already_sent: List = await redis.smismember('e621:sent', [p.id for p in posts]) - # last_index = len(posts) - # if already_sent.count(True): - # last_index = already_sent.index(True) - # await redis.sadd('e621:sent', *[posts[i].id for i in range(last_index, len(posts))]) - for i in list(range(len(posts)))[::-1]: - if already_sent[i]: - continue - await send_post(posts[i], tag_list) - await sleep(1) + for page in range(1, 11): + posts = await e621.get_posts(tags, page) + if not posts: + return + already_sent: List = await redis.smismember('e621:sent', [p.id for p in posts]) + # last_index = len(posts) + # if already_sent.count(True): + # last_index = already_sent.index(True) + # await redis.sadd('e621:sent', *[posts[i].id for i in range(last_index, len(posts))]) + for i in list(range(len(posts)))[::-1]: + if already_sent[i]: + continue + await send_post(posts[i], tag_list) + await sleep(1) @dp.message(filters.Command('add'), ChatFilter)