1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

improve foolslide volume- and chapter-keywords

This commit is contained in:
Mike Fährmann 2016-10-28 00:35:48 +02:00
parent 2a632c9bfd
commit 005c539829
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 13 additions and 8 deletions

View File

@ -16,7 +16,7 @@ class DokireaderChapterExtractor(FoolslideChapterExtractor):
pattern = [(r"(?:https?://)?(kobato\.hologfx\.com/reader/read/"
r"[^/]+/([a-z]{2})/\d+/\d+)")]
test = [("https://kobato.hologfx.com/reader/read/hitoribocchi_no_oo_seikatsu/en/3/34", {
"keyword": "303f3660772dd393ce01cf248f5cf376629aebc7",
"keyword": "4ee981ae14c6643f6a03a14c9f2c0d4898202671",
})]
def __init__(self, match):

View File

@ -16,8 +16,8 @@ import re
class FoolslideChapterExtractor(Extractor):
"""Base class for chapter extractors on foolslide based sites"""
subcategory = "chapter"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor} - {title}"]
filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}"
directory_fmt = ["{category}", "{manga}", "{chapter:>03} - {title}"]
filename_fmt = "{manga}_{chapter:>03}_{page:>03}.{extension}"
def __init__(self, url, lang):
Extractor.__init__(self)
@ -46,14 +46,19 @@ class FoolslideChapterExtractor(Extractor):
_ , pos = text.extract(page, '<h1 class="tbtitle dnone">', '')
manga , pos = text.extract(page, 'title="', '"', pos)
chapter , pos = text.extract(page, '">', '</a>', pos)
match = re.match(r"(\w+ (\d+)([^:+]*)(?:: (.*))?|[^:]+)", chapter)
parts = chapter.split(":", maxsplit=1)
match = re.match(r"(?:Vol.(\d+) )?(?:Chapter (\d+)$|(.+))", parts[0])
volume = match.group(1) or ""
chapter = match.group(2) or match.group(3).strip()
return {
"manga": text.unescape(manga),
"chapter": match.group(2) or match.group(1),
"chapter-minor": match.group(3) or "",
"chapter": chapter,
"volume": volume,
"lang": self.lang,
"language": iso639_1.code_to_language(self.lang),
"title": text.unescape(match.group(4) or ""),
"title": text.unescape(parts[1].strip() if len(parts) > 1 else ""),
}
@staticmethod

View File

@ -21,7 +21,7 @@ class PowermangaChapterExtractor(FoolslideChapterExtractor):
]
test = [("https://read.powermanga.org/read/one_piece/en/0/803/page/1", {
"url": "e6179c1565068f99180620281f86bdd25be166b4",
"keyword": "17f56ecad0e718735cd832abe84cb3c808cb2a5d",
"keyword": "51cabad8995727334e5ca9773c18d709b3868f02",
})]
def __init__(self, match):