1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[hiperdex] fix extraction (#3768)

This commit is contained in:
Mike Fährmann 2023-03-15 14:28:03 +01:00
parent e7898936df
commit 17bd053d94
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 13 additions and 23 deletions

View File

@ -309,7 +309,7 @@ Consider all sites to be NSFW unless otherwise known.
</tr>
<tr>
<td>Hiperdex</td>
<td>https://1sthiperdex.com/</td>
<td>https://hiperdex.com/</td>
<td>Artists, Chapters, Manga</td>
<td></td>
</tr>

View File

@ -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,7 @@ class HiperdexBase():
return {
"manga" : text.unescape(extr(
"<title>", "<").rpartition("&")[0].strip()),
"<title>", "<").rpartition(" - ")[0].strip()),
"score" : text.parse_float(extr(
'id="averagerate">', '<')),
"author" : text.remove_html(extr(
@ -65,10 +65,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 +86,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 +109,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/youre-not-that-special/", {
"count": 51,
"pattern": HiperdexChapterExtractor.pattern,
"keyword": {
@ -130,7 +130,7 @@ class HiperdexMangaExtractor(HiperdexBase, MangaExtractor):
"type" : "Manhwa",
},
}),
("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/"),
@ -145,19 +145,9 @@ class HiperdexMangaExtractor(HiperdexBase, MangaExtractor):
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",
}
url = self.root + "/wp-admin/admin-ajax.php"
page = self.request(url, method="POST", data=data).text
for url in text.extract_iter(page, 'data-redirect="', '"'):
for html in text.extract_iter(
page, '<li class="wp-manga-chapter', '</li>'):
url = text.extr(html, 'href="', '"')
chapter = url.rpartition("/")[2]
results.append((url, self.chapter_data(chapter)))