summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/fanbox.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-10-03 18:31:58 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-10-03 18:31:58 -0400
commitb8758ecd073910ce3220b2e68399147b425c37b8 (patch)
treed6aee20213508c8f425cbacb3d714367eca904c5 /gallery_dl/extractor/fanbox.py
parente2f67519f8c1750a71aab3dc56b8345fff21bac5 (diff)
New upstream version 1.26.0.upstream/1.26.0
Diffstat (limited to 'gallery_dl/extractor/fanbox.py')
-rw-r--r--gallery_dl/extractor/fanbox.py80
1 files changed, 7 insertions, 73 deletions
diff --git a/gallery_dl/extractor/fanbox.py b/gallery_dl/extractor/fanbox.py
index 373529f..4572bea 100644
--- a/gallery_dl/extractor/fanbox.py
+++ b/gallery_dl/extractor/fanbox.py
@@ -6,10 +6,9 @@
"""Extractors for https://www.fanbox.cc/"""
-import re
from .common import Extractor, Message
from .. import text
-
+import re
BASE_PATTERN = (
r"(?:https?://)?(?:"
@@ -27,17 +26,15 @@ class FanboxExtractor(Extractor):
archive_fmt = "{id}_{num}"
_warning = True
- def __init__(self, match):
- Extractor.__init__(self, match)
+ def _init(self):
self.embeds = self.config("embeds", True)
- def items(self):
-
if self._warning:
- if not self._check_cookies(("FANBOXSESSID",)):
+ if not self.cookies_check(("FANBOXSESSID",)):
self.log.warning("no 'FANBOXSESSID' cookie set")
FanboxExtractor._warning = False
+ def items(self):
for content_body, post in self.posts():
yield Message.Directory, post
yield from self._get_urls_from_post(content_body, post)
@@ -245,20 +242,7 @@ class FanboxCreatorExtractor(FanboxExtractor):
"""Extractor for a Fanbox creator's works"""
subcategory = "creator"
pattern = BASE_PATTERN + r"(?:/posts)?/?$"
- test = (
- ("https://xub.fanbox.cc", {
- "range": "1-15",
- "count": ">= 15",
- "keyword": {
- "creatorId" : "xub",
- "tags" : list,
- "title" : str,
- },
- }),
- ("https://xub.fanbox.cc/posts"),
- ("https://www.fanbox.cc/@xub/"),
- ("https://www.fanbox.cc/@xub/posts"),
- )
+ example = "https://USER.fanbox.cc/"
def __init__(self, match):
FanboxExtractor.__init__(self, match)
@@ -273,55 +257,7 @@ class FanboxPostExtractor(FanboxExtractor):
"""Extractor for media from a single Fanbox post"""
subcategory = "post"
pattern = BASE_PATTERN + r"/posts/(\d+)"
- test = (
- ("https://www.fanbox.cc/@xub/posts/1910054", {
- "count": 3,
- "keyword": {
- "title": "えま★おうがすと",
- "tags": list,
- "hasAdultContent": True,
- "isCoverImage": False
- },
- }),
- # entry post type, image embedded in html of the post
- ("https://nekoworks.fanbox.cc/posts/915", {
- "count": 2,
- "keyword": {
- "title": "【SAYORI FAN CLUB】お届け内容",
- "tags": list,
- "html": str,
- "hasAdultContent": True
- },
- }),
- # article post type, imageMap, 2 twitter embeds, fanbox embed
- ("https://steelwire.fanbox.cc/posts/285502", {
- "options": (("embeds", True),),
- "count": 10,
- "keyword": {
- "title": "イラスト+SS|義足の炭鉱少年が義足を見せてくれるだけ 【全体公開版】",
- "tags": list,
- "articleBody": dict,
- "hasAdultContent": True
- },
- }),
- # 'content' metadata (#3020)
- ("https://www.fanbox.cc/@official-en/posts/4326303", {
- "keyword": {
- "content": r"re:(?s)^Greetings from FANBOX.\n \nAs of Monday, "
- r"September 5th, 2022, we are happy to announce "
- r"the start of the FANBOX hashtag event "
- r"#MySetupTour ! \nAbout the event\nTo join this "
- r"event .+ \nPlease check this page for further "
- r"details regarding the Privacy & Terms.\n"
- r"https://fanbox.pixiv.help/.+/10184952456601\n\n\n"
- r"Thank you for your continued support of FANBOX.$",
- },
- }),
- # imageMap file order (#2718)
- ("https://mochirong.fanbox.cc/posts/3746116", {
- "url": "c92ddd06f2efc4a5fe30ec67e21544f79a5c4062",
- }),
- )
+ example = "https://USER.fanbox.cc/posts/12345"
def __init__(self, match):
FanboxExtractor.__init__(self, match)
@@ -336,9 +272,7 @@ class FanboxRedirectExtractor(Extractor):
category = "fanbox"
subcategory = "redirect"
pattern = r"(?:https?://)?(?:www\.)?pixiv\.net/fanbox/creator/(\d+)"
- test = ("https://www.pixiv.net/fanbox/creator/52336352", {
- "pattern": FanboxCreatorExtractor.pattern,
- })
+ example = "https://www.pixiv.net/fanbox/creator/12345"
def __init__(self, match):
Extractor.__init__(self, match)