Skip to content

Commit

Permalink
[hiperdex] fix extraction (#3768)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Mar 15, 2023
1 parent e789893 commit 17bd053
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
34 changes: 12 additions & 22 deletions gallery_dl/extractor/hiperdex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +20,7 @@
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):
Expand All @@ -31,7 +31,7 @@ def manga_data(self, manga, page=None):

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(
Expand Down Expand Up @@ -65,10 +65,10 @@ def chapter_data(self, chapter):


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",
Expand All @@ -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/"),
Expand All @@ -109,11 +109,11 @@ def images(self, page):


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": {
Expand All @@ -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/"),
Expand All @@ -145,19 +145,9 @@ 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",
}
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)))

Expand Down

0 comments on commit 17bd053

Please sign in to comment.