[fanbox] fetch data for each individual post (fixes #2388)
Posts from 'https://api.fanbox.cc/post.listCreator' do not contain a 'body' with all images anymore. https://github.com/mikf/gallery-dl/pull/1459#discussion_r614322881
This commit is contained in:
@@ -51,19 +51,16 @@ class FanboxExtractor(Extractor):
|
|||||||
url = text.ensure_http_scheme(url)
|
url = text.ensure_http_scheme(url)
|
||||||
body = self.request(url, headers=headers).json()["body"]
|
body = self.request(url, headers=headers).json()["body"]
|
||||||
for item in body["items"]:
|
for item in body["items"]:
|
||||||
yield self._process_post(item)
|
yield self._get_post_data(item["id"])
|
||||||
|
|
||||||
url = body["nextUrl"]
|
url = body["nextUrl"]
|
||||||
|
|
||||||
def _get_post_data_from_id(self, post_id):
|
def _get_post_data(self, post_id):
|
||||||
"""Fetch and process post data"""
|
"""Fetch and process post data"""
|
||||||
headers = {"Origin": self.root}
|
headers = {"Origin": self.root}
|
||||||
url = "https://api.fanbox.cc/post.info?postId="+post_id
|
url = "https://api.fanbox.cc/post.info?postId="+post_id
|
||||||
post = self.request(url, headers=headers).json()["body"]
|
post = self.request(url, headers=headers).json()["body"]
|
||||||
|
|
||||||
return self._process_post(post)
|
|
||||||
|
|
||||||
def _process_post(self, post):
|
|
||||||
content_body = post.pop("body", None)
|
content_body = post.pop("body", None)
|
||||||
if content_body:
|
if content_body:
|
||||||
if "html" in content_body:
|
if "html" in content_body:
|
||||||
@@ -279,7 +276,7 @@ class FanboxPostExtractor(FanboxExtractor):
|
|||||||
self.post_id = match.group(3)
|
self.post_id = match.group(3)
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
return (self._get_post_data_from_id(self.post_id),)
|
return (self._get_post_data(self.post_id),)
|
||||||
|
|
||||||
|
|
||||||
class FanboxRedirectExtractor(Extractor):
|
class FanboxRedirectExtractor(Extractor):
|
||||||
|
|||||||
Reference in New Issue
Block a user