diff options
Diffstat (limited to 'gallery_dl/extractor/hiperdex.py')
| -rw-r--r-- | gallery_dl/extractor/hiperdex.py | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/gallery_dl/extractor/hiperdex.py b/gallery_dl/extractor/hiperdex.py index d61c139..3aad88c 100644 --- a/gallery_dl/extractor/hiperdex.py +++ b/gallery_dl/extractor/hiperdex.py @@ -6,7 +6,7 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -"""Extractors for https://1sthiperdex.com/""" +"""Extractors for https://hiperdex.com/""" from .common import ChapterExtractor, MangaExtractor from .. import text @@ -20,7 +20,7 @@ BASE_PATTERN = (r"((?:https?://)?(?:www\.)?" class HiperdexBase(): """Base class for hiperdex extractors""" category = "hiperdex" - root = "https://1sthiperdex.com" + root = "https://hiperdex.com" @memcache(keyarg=1) def manga_data(self, manga, page=None): @@ -31,7 +31,9 @@ class HiperdexBase(): return { "manga" : text.unescape(extr( - "<title>", "<").rpartition("&")[0].strip()), + "<title>", "<").rpartition(" - ")[0].strip()), + "url" : text.unescape(extr( + 'property="og:url" content="', '"')), "score" : text.parse_float(extr( 'id="averagerate">', '<')), "author" : text.remove_html(extr( @@ -65,10 +67,10 @@ class HiperdexBase(): class HiperdexChapterExtractor(HiperdexBase, ChapterExtractor): - """Extractor for manga chapters from 1sthiperdex.com""" + """Extractor for manga chapters from hiperdex.com""" pattern = BASE_PATTERN + r"(/manga/([^/?#]+)/([^/?#]+))" test = ( - ("https://1sthiperdex.com/manga/domestic-na-kanojo/154-5/", { + ("https://hiperdex.com/manga/domestic-na-kanojo/154-5/", { "pattern": r"https://(1st)?hiperdex\d?.(com|net|info)" r"/wp-content/uploads/WP-manga/data" r"/manga_\w+/[0-9a-f]{32}/\d+\.webp", @@ -86,7 +88,7 @@ class HiperdexChapterExtractor(HiperdexBase, ChapterExtractor): "type" : "Manga", }, }), - ("https://hiperdex.com/manga/domestic-na-kanojo/154-5/"), + ("https://1sthiperdex.com/manga/domestic-na-kanojo/154-5/"), ("https://hiperdex2.com/manga/domestic-na-kanojo/154-5/"), ("https://hiperdex.net/manga/domestic-na-kanojo/154-5/"), ("https://hiperdex.info/manga/domestic-na-kanojo/154-5/"), @@ -109,11 +111,11 @@ class HiperdexChapterExtractor(HiperdexBase, ChapterExtractor): class HiperdexMangaExtractor(HiperdexBase, MangaExtractor): - """Extractor for manga from 1sthiperdex.com""" + """Extractor for manga from hiperdex.com""" chapterclass = HiperdexChapterExtractor pattern = BASE_PATTERN + r"(/manga/([^/?#]+))/?$" test = ( - ("https://1sthiperdex.com/manga/youre-not-that-special/", { + ("https://hiperdex.com/manga/1603231576-youre-not-that-special/", { "count": 51, "pattern": HiperdexChapterExtractor.pattern, "keyword": { @@ -131,6 +133,7 @@ class HiperdexMangaExtractor(HiperdexBase, MangaExtractor): }, }), ("https://hiperdex.com/manga/youre-not-that-special/"), + ("https://1sthiperdex.com/manga/youre-not-that-special/"), ("https://hiperdex2.com/manga/youre-not-that-special/"), ("https://hiperdex.net/manga/youre-not-that-special/"), ("https://hiperdex.info/manga/youre-not-that-special/"), @@ -142,25 +145,24 @@ class HiperdexMangaExtractor(HiperdexBase, MangaExtractor): MangaExtractor.__init__(self, match, self.root + path + "/") def chapters(self, page): - self.manga_data(self.manga, page) - results = [] - - shortlink = text.extr(page, "rel='shortlink' href='", "'") - data = { - "action" : "manga_get_reading_nav", - "manga" : shortlink.rpartition("=")[2], - "chapter" : "", - "volume_id": "", - "style" : "list", - "type" : "manga", + data = self.manga_data(self.manga, page) + self.manga_url = url = data["url"] + + url = self.manga_url + "ajax/chapters/" + headers = { + "Accept": "*/*", + "X-Requested-With": "XMLHttpRequest", + "Origin": self.root, + "Referer": self.manga_url, } - url = self.root + "/wp-admin/admin-ajax.php" - page = self.request(url, method="POST", data=data).text + html = self.request(url, method="POST", headers=headers).text - for url in text.extract_iter(page, 'data-redirect="', '"'): - chapter = url.rpartition("/")[2] + results = [] + for item in text.extract_iter( + html, '<li class="wp-manga-chapter', '</li>'): + url = text.extr(item, 'href="', '"') + chapter = url.rstrip("/").rpartition("/")[2] results.append((url, self.chapter_data(chapter))) - return results |
