use post versions to find updates
This commit is contained in:
33
e621.py
33
e621.py
@@ -132,6 +132,35 @@ class E621Post:
|
||||
duration: Optional[float]
|
||||
|
||||
|
||||
@dataclass_json
|
||||
@dataclass
|
||||
class E621PostVersion:
|
||||
id: int
|
||||
post_id: int
|
||||
tags: str
|
||||
updater_id: int
|
||||
updated_at: str
|
||||
rating: Rating
|
||||
parent_id: Optional[int]
|
||||
source: Optional[str]
|
||||
description: str
|
||||
reason: Optional[str]
|
||||
locked_tags: Optional[str]
|
||||
added_tags: List[str]
|
||||
removed_tags: List[str]
|
||||
added_locked_tags: List[str]
|
||||
removed_locked_tags: List[str]
|
||||
rating_changed: bool
|
||||
parent_changed: bool
|
||||
source_changed: bool
|
||||
description_changed: bool
|
||||
version: int
|
||||
obsolete_added_tags: str
|
||||
obsolete_removed_tags: str
|
||||
unchanged_tags: str
|
||||
updater_name: str
|
||||
|
||||
|
||||
class E621:
|
||||
def __init__(self):
|
||||
self.client = httpx.AsyncClient(headers={'user-agent': 'bot/1.0 (bakatrouble)'}, base_url='https://e621.net')
|
||||
@@ -142,3 +171,7 @@ class E621:
|
||||
|
||||
async def get_post(self, post_id: str) -> E621Post:
|
||||
return (await self.get_posts(f'id:{post_id}'))[0]
|
||||
|
||||
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()
|
||||
return [E621PostVersion.from_dict(p) for p in r]
|
||||
|
Reference in New Issue
Block a user