[fanbox] add 'home' and 'supporting' extractors (#5138)

pull/5224/head
Mike Fährmann 7 months ago
parent 04e4ffc64c
commit c97b92cc35
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -670,7 +670,7 @@ Consider all listed sites to potentially be NSFW.
<tr> <tr>
<td>pixivFANBOX</td> <td>pixivFANBOX</td>
<td>https://www.fanbox.cc/</td> <td>https://www.fanbox.cc/</td>
<td>Creators, Posts</td> <td>Creators, Home Feed, Posts, Pixiv Redirects, Supported User Feed</td>
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td> <td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
</tr> </tr>
<tr> <tr>

@ -11,7 +11,8 @@ from .. import text
from ..cache import memcache from ..cache import memcache
import re import re
BASE_PATTERN = ( BASE_PATTERN = r"(?:https?://)?(?:www\.)?fanbox\.cc"
USER_PATTERN = (
r"(?:https?://)?(?:" r"(?:https?://)?(?:"
r"(?!www\.)([\w-]+)\.fanbox\.cc|" r"(?!www\.)([\w-]+)\.fanbox\.cc|"
r"(?:www\.)?fanbox\.cc/@([\w-]+))" r"(?:www\.)?fanbox\.cc/@([\w-]+))"
@ -290,7 +291,7 @@ class FanboxExtractor(Extractor):
class FanboxCreatorExtractor(FanboxExtractor): class FanboxCreatorExtractor(FanboxExtractor):
"""Extractor for a Fanbox creator's works""" """Extractor for a Fanbox creator's works"""
subcategory = "creator" subcategory = "creator"
pattern = BASE_PATTERN + r"(?:/posts)?/?$" pattern = USER_PATTERN + r"(?:/posts)?/?$"
example = "https://USER.fanbox.cc/" example = "https://USER.fanbox.cc/"
def __init__(self, match): def __init__(self, match):
@ -305,7 +306,7 @@ class FanboxCreatorExtractor(FanboxExtractor):
class FanboxPostExtractor(FanboxExtractor): class FanboxPostExtractor(FanboxExtractor):
"""Extractor for media from a single Fanbox post""" """Extractor for media from a single Fanbox post"""
subcategory = "post" subcategory = "post"
pattern = BASE_PATTERN + r"/posts/(\d+)" pattern = USER_PATTERN + r"/posts/(\d+)"
example = "https://USER.fanbox.cc/posts/12345" example = "https://USER.fanbox.cc/posts/12345"
def __init__(self, match): def __init__(self, match):
@ -316,6 +317,28 @@ class FanboxPostExtractor(FanboxExtractor):
return (self._get_post_data(self.post_id),) return (self._get_post_data(self.post_id),)
class FanboxHomeExtractor(FanboxExtractor):
"""Extractor for your Fanbox home feed"""
subcategory = "home"
pattern = BASE_PATTERN + r"/?$"
example = "https://fanbox.cc/"
def posts(self):
url = "https://api.fanbox.cc/post.listHome?limit=10"
return self._pagination(url)
class FanboxSupportingExtractor(FanboxExtractor):
"""Extractor for your supported Fanbox users feed"""
subcategory = "supporting"
pattern = BASE_PATTERN + r"/home/supporting"
example = "https://fanbox.cc/home/supporting"
def posts(self):
url = "https://api.fanbox.cc/post.listSupporting?limit=10"
return self._pagination(url)
class FanboxRedirectExtractor(Extractor): class FanboxRedirectExtractor(Extractor):
"""Extractor for pixiv redirects to fanbox.cc""" """Extractor for pixiv redirects to fanbox.cc"""
category = "fanbox" category = "fanbox"

@ -153,6 +153,7 @@ SUBCATEGORY_MAP = {
"art" : "Art", "art" : "Art",
"audio" : "Audio", "audio" : "Audio",
"doujin" : "Doujin", "doujin" : "Doujin",
"home" : "Home Feed",
"image" : "individual Images", "image" : "individual Images",
"index" : "Site Index", "index" : "Site Index",
"issue" : "Comic Issues", "issue" : "Comic Issues",
@ -192,7 +193,8 @@ SUBCATEGORY_MAP = {
"watch-posts": "", "watch-posts": "",
}, },
"fanbox": { "fanbox": {
"redirect": "", "supporting": "Supported User Feed",
"redirect" : "Pixiv Redirects",
}, },
"fapello": { "fapello": {
"path": "Videos, Trending Posts, Popular Videos, Top Models", "path": "Videos, Trending Posts, Popular Videos, Top Models",
@ -200,7 +202,6 @@ SUBCATEGORY_MAP = {
"hatenablog": { "hatenablog": {
"archive": "Archive", "archive": "Archive",
"entry" : "Individual Posts", "entry" : "Individual Posts",
"home" : "Home Feed",
}, },
"hentaifoundry": { "hentaifoundry": {
"story": "", "story": "",
@ -256,14 +257,10 @@ SUBCATEGORY_MAP = {
"gifs": "", "gifs": "",
}, },
"raddle": { "raddle": {
"home" : "Home Feed",
"usersubmissions": "User Profiles", "usersubmissions": "User Profiles",
"post" : "Individual Posts", "post" : "Individual Posts",
"shorturl" : "", "shorturl" : "",
}, },
"reddit": {
"home": "Home Feed",
},
"redgifs": { "redgifs": {
"collections": "", "collections": "",
}, },

@ -131,6 +131,23 @@ __tests__ = (
"#sha1_url": "c92ddd06f2efc4a5fe30ec67e21544f79a5c4062", "#sha1_url": "c92ddd06f2efc4a5fe30ec67e21544f79a5c4062",
}, },
{
"#url" : "https://fanbox.cc/",
"#category": ("", "fanbox", "home"),
"#class" : fanbox.FanboxHomeExtractor,
"#auth" : True,
"#range" : "1-10",
"#count" : 10,
},
{
"#url" : "https://fanbox.cc/home/supporting",
"#category": ("", "fanbox", "supporting"),
"#class" : fanbox.FanboxSupportingExtractor,
"#auth" : True,
"#count" : 0,
},
{ {
"#url" : "https://www.pixiv.net/fanbox/creator/52336352", "#url" : "https://www.pixiv.net/fanbox/creator/52336352",
"#category": ("", "fanbox", "redirect"), "#category": ("", "fanbox", "redirect"),

Loading…
Cancel
Save