diff options
| author | 2025-04-16 15:12:41 -0400 | |
|---|---|---|
| committer | 2025-04-16 15:15:01 -0400 | |
| commit | ae8822ec0327c4d5674f1dc79de926b230f27f1f (patch) | |
| tree | e57027812d73baf7ab617222aa55ad2fe4c33a55 /src/portal/py/modules | |
| parent | 832b3ab11fd6457c59aed9d5bf12ba40c117f15d (diff) | |
| download | camu-ae8822ec0327c4d5674f1dc79de926b230f27f1f.tar.gz camu-ae8822ec0327c4d5674f1dc79de926b230f27f1f.tar.bz2 camu-ae8822ec0327c4d5674f1dc79de926b230f27f1f.zip | |
Highly wip waveform view
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/portal/py/modules')
| -rw-r--r-- | src/portal/py/modules/pixiv_web.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/portal/py/modules/pixiv_web.py b/src/portal/py/modules/pixiv_web.py index c6a9c82..3c04202 100644 --- a/src/portal/py/modules/pixiv_web.py +++ b/src/portal/py/modules/pixiv_web.py @@ -97,16 +97,15 @@ class PixivWebBase(Search): if not ugoira: url = f'{BASE_URL}/illust/{illust_id}/ugoira_meta?lang={LANG}&version={VERSION}' ugoira = self.check_api_response(self.module.do_request(Method.GET, url)) - if not ugoira: - return None - kwargs['raw_responses']['ugoira'] = json.dumps(ugoira) - kwargs['media'] = { '0': self.parse_ugoira(ugoira, data['urls']['original']) } elif data['pageCount'] > 1: if not pages: url = f'{BASE_URL}/illust/{illust_id}/pages?lang={LANG}&version={VERSION}' pages = self.check_api_response(self.module.do_request(Method.GET, url)) - if not pages: - return None + # Retrieving ugoria or pages could return 404. + if ugoira: + kwargs['raw_responses']['ugoira'] = json.dumps(ugoira) + kwargs['media'] = { '0': self.parse_ugoira(ugoira, data['urls']['original']) } + elif pages: kwargs['raw_responses']['pages'] = json.dumps(pages) kwargs['media'] = self.parse_pages(pages) else: @@ -142,7 +141,7 @@ class PixivWebBase(Search): url = f'{BASE_URL}/illust/{illust_id}?lang={LANG}&version={VERSION}' obj = self.check_api_response(self.module.do_request(Method.GET, url)) if not obj: - return None + return self.create_tombstone({ 'id': illust_id }) return self.create_post(obj) def create_user(self, data: ParsedJson) -> User: @@ -249,6 +248,8 @@ class PixivWebBookmarks(PixivWebBase): self.pages[num] = [] for illust in obj['works']: if illust['userId'] == 0: + # Is it worth assuming this is a tombstone? Should run some tests + # to see if an illust object is ever returned anyway. post = self.create_tombstone(illust) else: post = self.request_illust(int(illust['id'])) |