diff --git a/gallery_dl/extractor/exhentai.py b/gallery_dl/extractor/exhentai.py index 552ea4df3f..cbdf2da7c4 100644 --- a/gallery_dl/extractor/exhentai.py +++ b/gallery_dl/extractor/exhentai.py @@ -424,9 +424,11 @@ def _parse_original_info(info): class ExhentaiSearchExtractor(ExhentaiExtractor): """Extractor for exhentai search results""" subcategory = "search" - pattern = BASE_PATTERN + r"/?\?(.*)$" + pattern = BASE_PATTERN + r"/(?:\?([^#]*)|tag/([^/?#]+))" test = ( ("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" "&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"), { @@ -438,10 +440,20 @@ class ExhentaiSearchExtractor(ExhentaiExtractor): def __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 + _, 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): self.login() data = {"_extractor": ExhentaiGalleryExtractor} @@ -465,7 +477,7 @@ def items(self): class ExhentaiFavoriteExtractor(ExhentaiSearchExtractor): """Extractor for favorited exhentai galleries""" subcategory = "favorite" - pattern = BASE_PATTERN + r"/favorites\.php(?:\?(.*))?" + pattern = BASE_PATTERN + r"/favorites\.php(?:\?([^#]*)())?" test = ( ("https://e-hentai.org/favorites.php", { "count": 1,