fix pagination
This commit is contained in:
parent
3d5b96c794
commit
40177720c4
2
e621.py
2
e621.py
@ -174,4 +174,6 @@ class E621:
|
|||||||
|
|
||||||
async def get_post_versions(self, start_id=0, page=1, limit=320) -> List[E621PostVersion]:
|
async def get_post_versions(self, start_id=0, page=1, limit=320) -> List[E621PostVersion]:
|
||||||
r = (await self.client.get('/post_versions.json', params={'search[start_id]': start_id, 'limit': limit})).json()
|
r = (await self.client.get('/post_versions.json', params={'search[start_id]': start_id, 'limit': limit})).json()
|
||||||
|
if 'success' in r:
|
||||||
|
return []
|
||||||
return [E621PostVersion.from_dict(p) for p in r]
|
return [E621PostVersion.from_dict(p) for p in r]
|
||||||
|
1
main.py
1
main.py
@ -142,6 +142,7 @@ async def check_updates():
|
|||||||
tag_list = set(tuple(t.decode().split()) for t in await redis.smembers('e621:subs'))
|
tag_list = set(tuple(t.decode().split()) for t in await redis.smembers('e621:subs'))
|
||||||
last_post_version = int((await redis.get('e621:last_version') or b'0').decode())
|
last_post_version = int((await redis.get('e621:last_version') or b'0').decode())
|
||||||
post_versions: List[E621PostVersion] = []
|
post_versions: List[E621PostVersion] = []
|
||||||
|
logging.warning(f'Getting post versions from id {last_post_version}')
|
||||||
for page in count(1):
|
for page in count(1):
|
||||||
post_versions_page = await e621.get_post_versions(last_post_version, page)
|
post_versions_page = await e621.get_post_versions(last_post_version, page)
|
||||||
post_versions += post_versions_page
|
post_versions += post_versions_page
|
||||||
|
Loading…
Reference in New Issue
Block a user