[itaku] Add a new extractor for Itaku stars

This commit is contained in:
Deer-Spangle
2025-04-24 09:59:32 +01:00
parent c3fb0f53ee
commit 6bbedda08b

View File

@@ -85,6 +85,15 @@ class ItakuSearchExtractor(ItakuExtractor):
return self.api.search_images(params)
class ItakuStarsExtractor(ItakuExtractor):
subcategory = "stars"
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/stars(?:/(\d+))?"
example = "https://itaku.ee/profile/USER/stars"
def posts(self):
return self.api.stars_images(*self.groups)
class ItakuAPI():
def __init__(self, extractor):
@@ -139,6 +148,21 @@ class ItakuAPI():
}
return self._pagination(endpoint, params, self.image)
def stars_images(self, username: str, section: str = None):
endpoint = "/galleries/images/user_starred_imgs/"
params = {
"cursor" : None,
"stars_of": self.user(username)["owner"],
"sections" : section,
"date_range": "",
"ordering" : "-date_added",
"maturity_rating": ("SFW", "Questionable", "NSFW"),
"page" : "1",
"page_size" : "30",
"visibility": ("PUBLIC", "PROFILE_ONLY"),
}
return self._pagination(endpoint, params, self.image)
def image(self, image_id):
endpoint = "/galleries/images/{}/".format(image_id)
return self._call(endpoint)