1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[fanbox] support pixiv redirects (closes #2122)

This commit is contained in:
Mike Fährmann 2021-12-24 23:06:42 +01:00
parent 281828b58b
commit 22b0433985
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 24 additions and 0 deletions

View File

@ -280,3 +280,24 @@ class FanboxPostExtractor(FanboxExtractor):
def posts(self):
return (self._get_post_data_from_id(self.post_id),)
class FanboxRedirectExtractor(Extractor):
"""Extractor for pixiv redirects to fanbox.cc"""
category = "fanbox"
subcategory = "redirect"
pattern = r"(?:https?://)?(?:www\.)?pixiv\.net/fanbox/creator/(\d+)"
test = ("https://www.pixiv.net/fanbox/creator/52336352", {
"pattern": FanboxCreatorExtractor.pattern,
})
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

View File

@ -146,6 +146,9 @@ SUBCATEGORY_MAP = {
"stash": "Sta.sh",
"watch-posts": "",
},
"fanbox": {
"redirect": "",
},
"hentaifoundry": {
"story": "",
},