diff --git a/docs/configuration.rst b/docs/configuration.rst index 63b72ea1..cdb78003 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2615,8 +2615,9 @@ Description when processing a user profile. Supported values are - * ``"avatar"`` - * ``"photos"`` + + * ``avatar`` + * ``photos`` It is possible to use ``"all"`` instead of listing all values separately. @@ -3185,6 +3186,28 @@ Description Split ``stories`` elements into separate posts. +extractor.itaku.include +----------------------- +Type + * ``string`` + * ``list`` of ``strings`` +Default + ``"gallery"`` +Example + * ``"stars,gallery"`` + * ``["stars", "gallery"]`` +Description + A (comma-separated) list of subcategories to include + when processing a user profile. + + Supported values are + + * ``gallery`` + * ``stars`` + + It is possible to use ``"all"`` instead of listing all values separately. + + extractor.itaku.videos ---------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 45cade66..65410301 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -419,7 +419,8 @@ "itaku": { "sleep-request": "0.5-1.5", - "videos": true + "include": "gallery", + "videos" : true }, "iwara": { diff --git a/gallery_dl/extractor/itaku.py b/gallery_dl/extractor/itaku.py index d8ba4f66..016a91dc 100644 --- a/gallery_dl/extractor/itaku.py +++ b/gallery_dl/extractor/itaku.py @@ -8,11 +8,12 @@ """Extractors for https://itaku.ee/""" -from .common import Extractor, Message +from .common import Extractor, Message, Dispatch from ..cache import memcache from .. import text BASE_PATTERN = r"(?:https?://)?itaku\.ee" +USER_PATTERN = BASE_PATTERN + r"/profile/([^/?#]+)" class ItakuExtractor(Extractor): @@ -57,7 +58,7 @@ class ItakuExtractor(Extractor): class ItakuGalleryExtractor(ItakuExtractor): """Extractor for posts from an itaku user gallery""" subcategory = "gallery" - pattern = BASE_PATTERN + r"/profile/([^/?#]+)/gallery(?:/(\d+))?" + pattern = USER_PATTERN + r"/gallery(?:/(\d+))?" example = "https://itaku.ee/profile/USER/gallery" def posts(self): @@ -66,13 +67,26 @@ class ItakuGalleryExtractor(ItakuExtractor): class ItakuStarsExtractor(ItakuExtractor): subcategory = "stars" - pattern = BASE_PATTERN + r"/profile/([^/?#]+)/stars(?:/(\d+))?" + pattern = USER_PATTERN + r"/stars(?:/(\d+))?" example = "https://itaku.ee/profile/USER/stars" def posts(self): return self.api.galleries_images_starred(*self.groups) +class ItakuUserExtractor(Dispatch, ItakuExtractor): + """Extractor for itaku user profiles""" + pattern = USER_PATTERN + r"/?(?:$|\?|#)" + example = "https://itaku.ee/profile/USER" + + def items(self): + base = f"{self.root}/profile/{self.groups[0]}/" + return self._dispatch_extractors(( + (ItakuGalleryExtractor, base + "gallery"), + (ItakuStarsExtractor , base + "stara"), + ), ("gallery",)) + + class ItakuImageExtractor(ItakuExtractor): subcategory = "image" pattern = BASE_PATTERN + r"/images/(\d+)" diff --git a/test/results/itaku.py b/test/results/itaku.py index cde514ef..d31e9a5d 100644 --- a/test/results/itaku.py +++ b/test/results/itaku.py @@ -8,6 +8,14 @@ from gallery_dl.extractor import itaku __tests__ = ( +{ + "#url" : "https://itaku.ee/profile/piku", + "#class" : itaku.ItakuUserExtractor, + "#results" : ( + "https://itaku.ee/profile/piku/gallery", + ), +}, + { "#url" : "https://itaku.ee/profile/piku/gallery", "#category": ("", "itaku", "gallery"),