[itaku] implement 'include' option (#7707)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -419,7 +419,8 @@
|
||||
"itaku":
|
||||
{
|
||||
"sleep-request": "0.5-1.5",
|
||||
"videos": true
|
||||
"include": "gallery",
|
||||
"videos" : true
|
||||
},
|
||||
"iwara":
|
||||
{
|
||||
|
||||
@@ -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+)"
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user