[exhentai] support '/tag/' URLs (closes #1363)
This commit is contained in:
parent
90830daf85
commit
c7c3fef0bc
@ -424,9 +424,11 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor):
|
|||||||
class ExhentaiSearchExtractor(ExhentaiExtractor):
|
class ExhentaiSearchExtractor(ExhentaiExtractor):
|
||||||
"""Extractor for exhentai search results"""
|
"""Extractor for exhentai search results"""
|
||||||
subcategory = "search"
|
subcategory = "search"
|
||||||
pattern = BASE_PATTERN + r"/?\?(.*)$"
|
pattern = BASE_PATTERN + r"/(?:\?([^#]*)|tag/([^/?#]+))"
|
||||||
test = (
|
test = (
|
||||||
("https://e-hentai.org/?f_search=touhou"),
|
("https://e-hentai.org/?f_search=touhou"),
|
||||||
|
("https://exhentai.org/?f_cats=767&f_search=touhou"),
|
||||||
|
("https://exhentai.org/tag/parody:touhou+project"),
|
||||||
(("https://exhentai.org/?f_doujinshi=0&f_manga=0&f_artistcg=0"
|
(("https://exhentai.org/?f_doujinshi=0&f_manga=0&f_artistcg=0"
|
||||||
"&f_gamecg=0&f_western=0&f_non-h=1&f_imageset=0&f_cosplay=0"
|
"&f_gamecg=0&f_western=0&f_non-h=1&f_imageset=0&f_cosplay=0"
|
||||||
"&f_asianporn=0&f_misc=0&f_search=touhou&f_apply=Apply+Filter"), {
|
"&f_asianporn=0&f_misc=0&f_search=touhou&f_apply=Apply+Filter"), {
|
||||||
@ -438,10 +440,20 @@ class ExhentaiSearchExtractor(ExhentaiExtractor):
|
|||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
ExhentaiExtractor.__init__(self, match)
|
ExhentaiExtractor.__init__(self, match)
|
||||||
self.params = text.parse_query(match.group(2))
|
|
||||||
self.params["page"] = text.parse_int(self.params.get("page"))
|
|
||||||
self.search_url = self.root
|
self.search_url = self.root
|
||||||
|
|
||||||
|
_, query, tag = match.groups()
|
||||||
|
if tag:
|
||||||
|
if "+" in tag:
|
||||||
|
ns, _, tag = tag.rpartition(":")
|
||||||
|
tag = '{}:"{}$"'.format(ns, tag.replace("+", " "))
|
||||||
|
else:
|
||||||
|
tag += "$"
|
||||||
|
self.params = {"f_search": tag, "page": 0}
|
||||||
|
else:
|
||||||
|
self.params = text.parse_query(query)
|
||||||
|
self.params["page"] = text.parse_int(self.params.get("page"))
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
self.login()
|
self.login()
|
||||||
data = {"_extractor": ExhentaiGalleryExtractor}
|
data = {"_extractor": ExhentaiGalleryExtractor}
|
||||||
@ -465,7 +477,7 @@ class ExhentaiSearchExtractor(ExhentaiExtractor):
|
|||||||
class ExhentaiFavoriteExtractor(ExhentaiSearchExtractor):
|
class ExhentaiFavoriteExtractor(ExhentaiSearchExtractor):
|
||||||
"""Extractor for favorited exhentai galleries"""
|
"""Extractor for favorited exhentai galleries"""
|
||||||
subcategory = "favorite"
|
subcategory = "favorite"
|
||||||
pattern = BASE_PATTERN + r"/favorites\.php(?:\?(.*))?"
|
pattern = BASE_PATTERN + r"/favorites\.php(?:\?([^#]*)())?"
|
||||||
test = (
|
test = (
|
||||||
("https://e-hentai.org/favorites.php", {
|
("https://e-hentai.org/favorites.php", {
|
||||||
"count": 1,
|
"count": 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user