[itaku] support gallery section URLs (#6951)
This commit is contained in:
@@ -24,10 +24,6 @@ class ItakuExtractor(Extractor):
|
||||
archive_fmt = "{id}"
|
||||
request_interval = (0.5, 1.5)
|
||||
|
||||
def __init__(self, match):
|
||||
Extractor.__init__(self, match)
|
||||
self.item = match.group(1)
|
||||
|
||||
def _init(self):
|
||||
self.api = ItakuAPI(self)
|
||||
self.videos = self.config("videos", True)
|
||||
@@ -62,11 +58,11 @@ class ItakuExtractor(Extractor):
|
||||
class ItakuGalleryExtractor(ItakuExtractor):
|
||||
"""Extractor for posts from an itaku user gallery"""
|
||||
subcategory = "gallery"
|
||||
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/gallery"
|
||||
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/gallery(?:/(\d+))?"
|
||||
example = "https://itaku.ee/profile/USER/gallery"
|
||||
|
||||
def posts(self):
|
||||
return self.api.galleries_images(self.item)
|
||||
return self.api.galleries_images(*self.groups)
|
||||
|
||||
|
||||
class ItakuImageExtractor(ItakuExtractor):
|
||||
@@ -75,7 +71,7 @@ class ItakuImageExtractor(ItakuExtractor):
|
||||
example = "https://itaku.ee/images/12345"
|
||||
|
||||
def posts(self):
|
||||
return (self.api.image(self.item),)
|
||||
return (self.api.image(self.groups[0]),)
|
||||
|
||||
|
||||
class ItakuSearchExtractor(ItakuExtractor):
|
||||
@@ -84,7 +80,7 @@ class ItakuSearchExtractor(ItakuExtractor):
|
||||
example = "https://itaku.ee/home/images?tags=SEARCH"
|
||||
|
||||
def posts(self):
|
||||
params = text.parse_query_list(self.item)
|
||||
params = text.parse_query_list(self.groups[0])
|
||||
return self.api.search_images(params)
|
||||
|
||||
|
||||
@@ -138,7 +134,7 @@ class ItakuAPI():
|
||||
params = {
|
||||
"cursor" : None,
|
||||
"owner" : self.user(username)["owner"],
|
||||
"section" : section,
|
||||
"sections" : section,
|
||||
"date_range": "",
|
||||
"maturity_rating": ("SFW", "Questionable", "NSFW"),
|
||||
"ordering" : "-date_added",
|
||||
|
||||
@@ -17,6 +17,19 @@ __tests__ = (
|
||||
"#count" : 10,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://itaku.ee/profile/piku/gallery/7391",
|
||||
"#comment" : "gallery section (#6951)",
|
||||
"#category": ("", "itaku", "gallery"),
|
||||
"#class" : itaku.ItakuGalleryExtractor,
|
||||
"#urls" : (
|
||||
"https://itaku.ee/api/media/gallery_imgs/misty-psyduck_IWbYdwT.png",
|
||||
"https://itaku.ee/api/media/gallery_imgs/bea_alpha_N0YGfeT.png",
|
||||
),
|
||||
|
||||
"sections" : ["Fanart/Pokemon"],
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://itaku.ee/images/100471",
|
||||
"#category": ("", "itaku", "image"),
|
||||
|
||||
Reference in New Issue
Block a user