2018-09-05 21:08:40 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-02-05 10:22:52 +01:00
|
|
|
# Copyright 2018-2019 Mike Fährmann
|
2018-09-05 21:08:40 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
|
|
|
"""Extractors for https://hentai.cafe/"""
|
|
|
|
|
|
|
|
from . import foolslide
|
|
|
|
from .. import text
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
class HentaicafeChapterExtractor(foolslide.FoolslideChapterExtractor):
|
|
|
|
"""Extractor for manga-chapters from hentai.cafe"""
|
|
|
|
category = "hentaicafe"
|
2019-02-08 13:45:40 +01:00
|
|
|
directory_fmt = ("{category}", "{manga}")
|
|
|
|
pattern = (r"(?:https?://)?(?:www\.)?hentai\.cafe"
|
|
|
|
r"(/manga/read/[^/?&#]+/[a-z-]+/\d+/\d+(?:/\d+)?)")
|
|
|
|
test = ("https://hentai.cafe/manga/read/saitom-box/en/0/1/", {
|
2018-09-05 21:08:40 +02:00
|
|
|
"url": "8c6a8c56875ba3ed7ab0a74a64f9960077767fc2",
|
2019-04-19 23:02:29 +02:00
|
|
|
"keyword": "7182d262810faa692827c947d2f360dfcb8d5e43",
|
2019-02-08 13:45:40 +01:00
|
|
|
})
|
2019-02-05 10:22:52 +01:00
|
|
|
root = "https://hentai.cafe"
|
2018-09-05 21:08:40 +02:00
|
|
|
|
2019-02-11 18:38:47 +01:00
|
|
|
def metadata(self, page):
|
2018-09-05 21:08:40 +02:00
|
|
|
info = text.unescape(text.extract(page, '<title>', '</title>')[0])
|
|
|
|
manga, _, chapter_string = info.partition(" :: ")
|
2019-02-11 18:38:47 +01:00
|
|
|
return self.parse_chapter_url(self.chapter_url, {
|
2018-09-05 21:08:40 +02:00
|
|
|
"manga": manga,
|
|
|
|
"chapter_string": chapter_string.rstrip(" :"),
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
class HentaicafeMangaExtractor(foolslide.FoolslideMangaExtractor):
|
|
|
|
"""Extractor for manga from hentai.cafe"""
|
|
|
|
category = "hentaicafe"
|
2019-02-08 13:45:40 +01:00
|
|
|
pattern = (r"(?:https?://)?" + r"(?:www\.)?hentai\.cafe"
|
|
|
|
r"((?:/manga/series)?/[^/?&#]+)/?$")
|
|
|
|
test = (
|
2018-09-05 21:08:40 +02:00
|
|
|
# single chapter
|
|
|
|
("https://hentai.cafe/hazuki-yuuto-summer-blues/", {
|
|
|
|
"url": "f8e24a07d6fbb7c6a6ec5ad8ad8faf2436f8751b",
|
|
|
|
}),
|
|
|
|
# multi-chapter
|
|
|
|
("https://hentai.cafe/saitom-saitom-box/", {
|
|
|
|
"url": "ca3e8a91531fd6acd863d93ac3afbd8ead06a076",
|
|
|
|
}),
|
|
|
|
# foolslide URL
|
|
|
|
("https://hentai.cafe/manga/series/saitom-box/", {
|
|
|
|
"url": "ca3e8a91531fd6acd863d93ac3afbd8ead06a076",
|
2019-04-19 23:02:29 +02:00
|
|
|
"keyword": "f0ece32d958f889d8229ed4052716d398a0a875c",
|
2018-09-05 21:08:40 +02:00
|
|
|
}),
|
2019-02-08 13:45:40 +01:00
|
|
|
)
|
2019-02-05 10:22:52 +01:00
|
|
|
root = "https://hentai.cafe"
|
2018-09-05 21:08:40 +02:00
|
|
|
reverse = False
|
2019-02-17 18:15:40 +01:00
|
|
|
chapterclass = HentaicafeChapterExtractor
|
2018-09-05 21:08:40 +02:00
|
|
|
|
|
|
|
def chapters(self, page):
|
2019-02-11 18:38:47 +01:00
|
|
|
if "/manga/series/" in self.manga_url:
|
2018-09-05 21:08:40 +02:00
|
|
|
chapters = foolslide.FoolslideMangaExtractor.chapters(self, page)
|
|
|
|
chapters.reverse()
|
|
|
|
return chapters
|
|
|
|
|
|
|
|
return [
|
|
|
|
(url, {})
|
|
|
|
for url in re.findall(
|
|
|
|
r'<a +class="x-btn[^"]*" +href="([^"]+)"', page)
|
|
|
|
]
|