[itaku] update
- simplify code - update docs/supportedsites - update test results
This commit is contained in:
@@ -478,7 +478,7 @@ Consider all listed sites to potentially be NSFW.
|
||||
<tr>
|
||||
<td>Itaku</td>
|
||||
<td>https://itaku.ee/</td>
|
||||
<td>Galleries, individual Images</td>
|
||||
<td>Galleries, individual Images, Search Results</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -102,15 +102,15 @@ class ItakuAPI():
|
||||
required_tags = []
|
||||
negative_tags = []
|
||||
optional_tags = []
|
||||
tags = []
|
||||
tags_param = params.get("tags")
|
||||
if isinstance(tags_param, str):
|
||||
tags = [tags_param]
|
||||
elif isinstance(tags_param, list):
|
||||
tags = tags_param
|
||||
|
||||
tags = params.pop("tags", None)
|
||||
if not tags:
|
||||
tags = ()
|
||||
elif isinstance(tags, str):
|
||||
tags = (tags,)
|
||||
|
||||
for tag in tags:
|
||||
if len(tag) == 0:
|
||||
if not tag:
|
||||
pass
|
||||
elif tag[0] == "-":
|
||||
negative_tags.append(tag[1:])
|
||||
@@ -119,22 +119,18 @@ class ItakuAPI():
|
||||
else:
|
||||
required_tags.append(tag)
|
||||
|
||||
# Every param is simply passed through to the api, except "tags"
|
||||
if "tags" in params:
|
||||
del params["tags"]
|
||||
|
||||
api_params = {
|
||||
"required_tags": required_tags,
|
||||
"negative_tags": negative_tags,
|
||||
"optional_tags": optional_tags,
|
||||
"page": 1,
|
||||
"page_size": 30,
|
||||
"date_range": "",
|
||||
"maturity_rating": ("SFW", "Questionable", "NSFW"),
|
||||
"ordering": "-date_added",
|
||||
"ordering" : "-date_added",
|
||||
"page" : "1",
|
||||
"page_size" : "30",
|
||||
"visibility": ("PUBLIC", "PROFILE_ONLY"),
|
||||
**params
|
||||
}
|
||||
|
||||
api_params.update(params)
|
||||
return self._pagination(endpoint, api_params, self.image)
|
||||
|
||||
def galleries_images(self, username, section=None):
|
||||
|
||||
@@ -83,7 +83,8 @@ __tests__ = (
|
||||
"#comment" : "simple search",
|
||||
"#category": ("", "itaku", "search"),
|
||||
"#class" : itaku.ItakuSearchExtractor,
|
||||
"#count" : "> 1",
|
||||
"#range" : "1-10",
|
||||
"#count" : 10,
|
||||
},
|
||||
|
||||
{
|
||||
@@ -91,7 +92,7 @@ __tests__ = (
|
||||
"#comment" : "search for videos",
|
||||
"#category": ("", "itaku", "search"),
|
||||
"#class" : itaku.ItakuSearchExtractor,
|
||||
"#count" : 30,
|
||||
"#count" : range(5, 50),
|
||||
},
|
||||
|
||||
{
|
||||
@@ -99,6 +100,6 @@ __tests__ = (
|
||||
"#comment" : "search with postive, negative, and optional tags",
|
||||
"#category": ("", "itaku", "search"),
|
||||
"#class" : itaku.ItakuSearchExtractor,
|
||||
"#count" : 0
|
||||
"#count" : 0,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user