[itaku] Add a new extractor for Itaku stars
This commit is contained in:
@@ -85,6 +85,15 @@ class ItakuSearchExtractor(ItakuExtractor):
|
|||||||
return self.api.search_images(params)
|
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():
|
class ItakuAPI():
|
||||||
|
|
||||||
def __init__(self, extractor):
|
def __init__(self, extractor):
|
||||||
@@ -139,6 +148,21 @@ class ItakuAPI():
|
|||||||
}
|
}
|
||||||
return self._pagination(endpoint, params, self.image)
|
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):
|
def image(self, image_id):
|
||||||
endpoint = "/galleries/images/{}/".format(image_id)
|
endpoint = "/galleries/images/{}/".format(image_id)
|
||||||
return self._call(endpoint)
|
return self._call(endpoint)
|
||||||
|
|||||||
Reference in New Issue
Block a user