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