Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hentai.cafe extractor: prefer manga title of /hc.fyi/ #1106

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gallery_dl/extractor/hentaicafe.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def metadata(self, page):
manga, _, chapter_string = info.partition(" :: ")

data = self._data(self.gallery_url.split("/")[5])
data["manga"] = manga
data.setdefault('manga', manga) # set manga, which defaults to that from MangaExtractor
data["chapter_string"] = chapter_string.rstrip(" :")
return self.parse_chapter_url(self.gallery_url, data)

Expand Down Expand Up @@ -80,11 +80,14 @@ def chapters(self, page):
chapters.reverse()
return chapters

url , pos = text.extract(page, '<link rel="canonical" href="', '"')
manga_title: str
manga_title, pos = text.extract(page, '<title>', '</title>')
url, pos = text.extract(page, '<link rel="canonical" href="', '"', pos)
tags , pos = text.extract(page, "<p>Tags: ", "</br>", pos)
artist, pos = text.extract(page, "\nArtists: ", "</br>", pos)
manga , pos = text.extract(page, "/manga/read/", "/", pos)
data = {
'manga' : manga_title.partition(' | ')[0],
"manga_id": text.parse_int(url.rpartition("/")[2]),
"tags" : text.split_html(tags)[::2],
"artist" : text.split_html(artist),
Expand Down