[hentaicafe] add 'manga_id' metadata field (closes #1036)

This field is only available when using a non-foolslide URL
like '/hc.fyi/9874' or '/hazuki-yuuto-summer-blues/'
pull/1038/head
Mike Fährmann 4 years ago
parent 117582d798
commit 9a9d1924d8
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018-2019 Mike Fährmann
# Copyright 2018-2020 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@ -50,17 +50,17 @@ class HentaicafeMangaExtractor(foolslide.FoolslideMangaExtractor):
# single chapter
("https://hentai.cafe/hazuki-yuuto-summer-blues/", {
"url": "f8e24a07d6fbb7c6a6ec5ad8ad8faf2436f8751b",
"keyword": "eb9f98544098c961bd8cf5dbe69e6da51c4fb2f6",
"keyword": "5af1c570bb5f533a32b3375f9cdaa17a0152ba67",
}),
# multi-chapter
("https://hentai.cafe/saitom-saitom-box/", {
"url": "ca3e8a91531fd6acd863d93ac3afbd8ead06a076",
"keyword": "28271062d7b4a2f99a0e1a894f69af8c5581a6bb",
"keyword": "3c28517d356cac6acbd9895c9eeefae505304078",
}),
# new-style URL
("https://hentai.cafe/hc.fyi/2782", {
"url": "ca3e8a91531fd6acd863d93ac3afbd8ead06a076",
"keyword": "28271062d7b4a2f99a0e1a894f69af8c5581a6bb",
"keyword": "3c28517d356cac6acbd9895c9eeefae505304078",
}),
# foolslide URL
("https://hentai.cafe/manga/series/saitom-box/", {
@ -80,12 +80,14 @@ class HentaicafeMangaExtractor(foolslide.FoolslideMangaExtractor):
chapters.reverse()
return chapters
tags , pos = text.extract(page, "<p>Tags: ", "</br>")
url , pos = text.extract(page, '<link rel="canonical" href="', '"')
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 = {
"tags" : text.split_html(tags)[::2],
"artist": text.split_html(artist),
"manga_id": text.parse_int(url.rpartition("/")[2]),
"tags" : text.split_html(tags)[::2],
"artist" : text.split_html(artist),
}
HentaicafeChapterExtractor._data(manga).update(data)

Loading…
Cancel
Save