[pixiv] improve API error messages
This commit is contained in:
@@ -443,9 +443,8 @@ class PixivArtworksExtractor(PixivExtractor):
|
|||||||
def works(self):
|
def works(self):
|
||||||
works = self.api.user_illusts(self.user_id)
|
works = self.api.user_illusts(self.user_id)
|
||||||
|
|
||||||
if self.sanity_workaround:
|
if self.sanity_workaround and (body := self._request_ajax(
|
||||||
body = self._request_ajax(
|
f"/user/{self.user_id}/profile/all")):
|
||||||
f"/user/{self.user_id}/profile/all")
|
|
||||||
try:
|
try:
|
||||||
ajax_ids = list(map(int, body["illusts"]))
|
ajax_ids = list(map(int, body["illusts"]))
|
||||||
ajax_ids.extend(map(int, body["manga"]))
|
ajax_ids.extend(map(int, body["manga"]))
|
||||||
@@ -1297,7 +1296,10 @@ class PixivAppAPI():
|
|||||||
self.extractor.wait(seconds=300)
|
self.extractor.wait(seconds=300)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
raise exception.AbortExtraction(f"API request failed: {error}")
|
msg = (f"'{msg}'" if (msg := error.get("user_message")) else
|
||||||
|
f"'{msg}'" if (msg := error.get("message")) else
|
||||||
|
error)
|
||||||
|
raise exception.AbortExtraction(f"API request failed: {msg}")
|
||||||
|
|
||||||
def _pagination(self, endpoint, params,
|
def _pagination(self, endpoint, params,
|
||||||
key_items="illusts", key_data=None, user_data=None):
|
key_items="illusts", key_data=None, user_data=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user