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:
parent
281828b58b
commit
22b0433985
@ -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
|
||||
|
@ -146,6 +146,9 @@ SUBCATEGORY_MAP = {
|
||||
"stash": "Sta.sh",
|
||||
"watch-posts": "",
|
||||
},
|
||||
"fanbox": {
|
||||
"redirect": "",
|
||||
},
|
||||
"hentaifoundry": {
|
||||
"story": "",
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user