aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/fanbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/fanbox.py')
-rw-r--r--gallery_dl/extractor/fanbox.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/gallery_dl/extractor/fanbox.py b/gallery_dl/extractor/fanbox.py
index 9bbfb43..3b43134 100644
--- a/gallery_dl/extractor/fanbox.py
+++ b/gallery_dl/extractor/fanbox.py
@@ -173,15 +173,16 @@ class FanboxExtractor(Extractor):
return plans
def _get_comment_data(self, post_id):
- url = ("https://api.fanbox.cc/post.listComments"
+ url = ("https://api.fanbox.cc/post.getComments"
"?limit=10&postId=" + post_id)
comments = []
while url:
url = text.ensure_http_scheme(url)
body = self.request(url, headers=self.headers).json()["body"]
- comments.extend(body["items"])
- url = body["nextUrl"]
+ data = body["commentList"]
+ comments.extend(data["items"])
+ url = data["nextUrl"]
return comments
def _get_urls_from_post(self, content_body, post):
@@ -296,8 +297,7 @@ class FanboxExtractor(Extractor):
url = "https://www.pixiv.net/fanbox/"+content_id
# resolve redirect
try:
- url = self.request(url, method="HEAD",
- allow_redirects=False).headers["location"]
+ url = self.request_location(url)
except Exception as exc:
url = None
self.log.warning("Unable to extract fanbox embed %s (%s: %s)",
@@ -392,13 +392,7 @@ class FanboxRedirectExtractor(Extractor):
pattern = r"(?:https?://)?(?:www\.)?pixiv\.net/fanbox/creator/(\d+)"
example = "https://www.pixiv.net/fanbox/creator/12345"
- def __init__(self, match):
- Extractor.__init__(self, match)
- self.user_id = match.group(1)
-
def items(self):
- url = "https://www.pixiv.net/fanbox/creator/" + self.user_id
- data = {"_extractor": FanboxCreatorExtractor}
- response = self.request(
- url, method="HEAD", allow_redirects=False, notfound="user")
- yield Message.Queue, response.headers["Location"], data
+ url = "https://www.pixiv.net/fanbox/creator/" + self.groups[0]
+ location = self.request_location(url, notfound="user")
+ yield Message.Queue, location, {"_extractor": FanboxCreatorExtractor}