mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[pixiv] make '_request_ajax()' non-fatal
This commit is contained in:
parent
bc954eb7e4
commit
1f5f04e673
@ -79,6 +79,7 @@ class PixivExtractor(Extractor):
|
||||
if self.sanity_workaround and not work.get("caption") and \
|
||||
not work.get("_mypixiv"):
|
||||
body = self._request_ajax("/illust/" + str(work["id"]))
|
||||
if body:
|
||||
work["caption"] = text.unescape(body["illustComment"])
|
||||
|
||||
if transform_tags:
|
||||
@ -177,8 +178,10 @@ class PixivExtractor(Extractor):
|
||||
|
||||
def _request_ajax(self, endpoint):
|
||||
url = "{}/ajax{}".format(self.root, endpoint)
|
||||
data = self.request(url, headers=self.headers_web).json()
|
||||
return data["body"]
|
||||
try:
|
||||
return self.request(url, headers=self.headers_web).json()["body"]
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def _extract_ajax(self, work, body):
|
||||
url = self._extract_ajax_url(body)
|
||||
|
Loading…
Reference in New Issue
Block a user