diff options
| author | 2024-12-22 05:45:25 -0500 | |
|---|---|---|
| committer | 2024-12-22 05:45:25 -0500 | |
| commit | 68cc5921fab97c0c3609b78838f269e6883af35b (patch) | |
| tree | f427342e95ddf535e9465c5a5b87e3567a96faaf /gallery_dl/extractor/itaku.py | |
| parent | 2a5605e9f5348fe08b246ccd5c78c43c890c8896 (diff) | |
| parent | bb8260277ab7483652c6c1526a15d62da92acc96 (diff) | |
Update upstream source from tag 'upstream/1.28.2'
Update to upstream version '1.28.2'
with Debian dir fd5292656afeea7f61ec976dd10e1aab9da1dd13
Diffstat (limited to 'gallery_dl/extractor/itaku.py')
| -rw-r--r-- | gallery_dl/extractor/itaku.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gallery_dl/extractor/itaku.py b/gallery_dl/extractor/itaku.py index 1aef66e..7f941bb 100644 --- a/gallery_dl/extractor/itaku.py +++ b/gallery_dl/extractor/itaku.py @@ -78,6 +78,16 @@ class ItakuImageExtractor(ItakuExtractor): return (self.api.image(self.item),) +class ItakuSearchExtractor(ItakuExtractor): + subcategory = "search" + pattern = BASE_PATTERN + r"/home/images/?\?([^#]+)" + example = "https://itaku.ee/home/images?tags=SEARCH" + + def posts(self): + params = text.parse_query_list(self.item) + return self.api.search_images(params) + + class ItakuAPI(): def __init__(self, extractor): @@ -87,6 +97,42 @@ class ItakuAPI(): "Accept": "application/json, text/plain, */*", } + def search_images(self, params): + endpoint = "/galleries/images/" + required_tags = [] + negative_tags = [] + optional_tags = [] + + tags = params.pop("tags", None) + if not tags: + tags = () + elif isinstance(tags, str): + tags = (tags,) + + for tag in tags: + if not tag: + pass + elif tag[0] == "-": + negative_tags.append(tag[1:]) + elif tag[0] == "~": + optional_tags.append(tag[1:]) + else: + required_tags.append(tag) + + api_params = { + "required_tags": required_tags, + "negative_tags": negative_tags, + "optional_tags": optional_tags, + "date_range": "", + "maturity_rating": ("SFW", "Questionable", "NSFW"), + "ordering" : "-date_added", + "page" : "1", + "page_size" : "30", + "visibility": ("PUBLIC", "PROFILE_ONLY"), + } + api_params.update(params) + return self._pagination(endpoint, api_params, self.image) + def galleries_images(self, username, section=None): endpoint = "/galleries/images/" params = { |
