[itaku] add 'bookmarks' extractor (#7707)

This commit is contained in:
Mike Fährmann
2025-07-27 19:31:12 +02:00
parent 022f216217
commit 013307af80
3 changed files with 58 additions and 3 deletions

View File

@@ -514,7 +514,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Itaku</td>
<td>https://itaku.ee/</td>
<td>Followers, Followed Users, Galleries, individual Images, Posts, Search Results, Stars, User Profiles</td>
<td>Bookmarks, Followers, Followed Users, Galleries, individual Images, Posts, Search Results, Stars, User Profiles</td>
<td></td>
</tr>
<tr>

View File

@@ -86,7 +86,7 @@ class ItakuExtractor(Extractor):
class ItakuGalleryExtractor(ItakuExtractor):
"""Extractor for images from an itaku user gallery"""
"""Extractor for an itaku user's gallery"""
subcategory = "gallery"
pattern = USER_PATTERN + r"/gallery(?:/(\d+))?"
example = "https://itaku.ee/profile/USER/gallery"
@@ -118,6 +118,7 @@ class ItakuPostsExtractor(ItakuExtractor):
class ItakuStarsExtractor(ItakuExtractor):
"""Extractor for an itaku user's starred images"""
subcategory = "stars"
pattern = USER_PATTERN + r"/stars(?:/(\d+))?"
example = "https://itaku.ee/profile/USER/stars"
@@ -153,6 +154,28 @@ class ItakuFollowersExtractor(ItakuExtractor):
})
class ItakuBookmarksExtractor(ItakuExtractor):
"""Extractor for an itaku bookmarks folder"""
subcategory = "bookmarks"
pattern = USER_PATTERN + r"/bookmarks/(image|user)/(\d+)"
example = "https://itaku.ee/profile/USER/bookmarks/image/12345"
def _init(self):
if self.groups[1] == "user":
self.images = util.noop
ItakuExtractor._init(self)
def images(self):
return self.api.galleries_images({
"bookmark_folder": self.groups[2],
})
def users(self):
return self.api.user_profiles({
"bookmark_folder": self.groups[2],
})
class ItakuUserExtractor(Dispatch, ItakuExtractor):
"""Extractor for itaku user profiles"""
pattern = USER_PATTERN + r"/?(?:$|\?|#)"
@@ -165,7 +188,7 @@ class ItakuUserExtractor(Dispatch, ItakuExtractor):
(ItakuPostsExtractor , base + "posts"),
(ItakuFollowersExtractor, base + "followers"),
(ItakuFollowingExtractor, base + "following"),
(ItakuStarsExtractor , base + "stara"),
(ItakuStarsExtractor , base + "stars"),
), ("gallery",))

View File

@@ -16,6 +16,19 @@ __tests__ = (
),
},
{
"#url" : "https://itaku.ee/profile/piku",
"#class" : itaku.ItakuUserExtractor,
"#options" : {"include": "all"},
"#results" : (
"https://itaku.ee/profile/piku/gallery",
"https://itaku.ee/profile/piku/posts",
"https://itaku.ee/profile/piku/followers",
"https://itaku.ee/profile/piku/following",
"https://itaku.ee/profile/piku/stars",
),
},
{
"#url" : "https://itaku.ee/profile/piku/gallery",
"#class" : itaku.ItakuGalleryExtractor,
@@ -90,6 +103,25 @@ __tests__ = (
"#count" : 60,
},
{
"#url" : "https://itaku.ee/profile/USER/bookmarks/image/13712",
"#class" : itaku.ItakuBookmarksExtractor,
"#results" : (
"https://itaku.ee/api/media/gallery_imgs/220511_rdGpatf.png",
"https://itaku.ee/api/media/gallery_imgs/220504_oUNIAFT.png",
"https://itaku.ee/api/media/gallery_vids/sleepy_af_OY5GHWw.mp4",
),
},
{
"#url" : "https://itaku.ee/profile/USER/bookmarks/user/11069",
"#class" : itaku.ItakuBookmarksExtractor,
"#results" : (
"https://itaku.ee/profile/deliciousorange",
"https://itaku.ee/profile/piku",
),
},
{
"#url" : "https://itaku.ee/images/100471",
"#class" : itaku.ItakuImageExtractor,