rename safe_int to parse_int; move parse_* to text module

This commit is contained in:
Mike Fährmann
2018-04-20 14:53:21 +02:00
parent ff643793bd
commit cc36f88586
37 changed files with 210 additions and 189 deletions

View File

@@ -9,7 +9,7 @@
"""Extract manga-chapters and entire manga from https://mangapark.me/"""
from .common import ChapterExtractor, MangaExtractor
from .. import text, util
from .. import text
from urllib.parse import urljoin
@@ -25,12 +25,12 @@ class MangaparkExtractor():
for part in path.split("/")[3:]:
key, value = part[0], part[1:]
if key == "s":
data["version"] = util.safe_int(value)
data["version"] = text.parse_int(value)
elif key == "v":
data["volume"] = util.safe_int(value)
data["volume"] = text.parse_int(value)
elif key == "c":
chapter, dot, minor = value.partition(".")
data["chapter"] = util.safe_int(chapter)
data["chapter"] = text.parse_int(chapter)
data["chapter_minor"] = dot + minor
elif key == "e":
data["chapter_minor"] = "v" + value
@@ -64,7 +64,7 @@ class MangaparkMangaExtractor(MangaparkExtractor, MangaExtractor):
self.parse_chapter_path(path, data)
data["title"] = title[3:].strip()
data["date"] = date
data["count"] = util.safe_int(count)
data["count"] = text.parse_int(count)
results.append((self.root + path, data.copy()))
@@ -107,7 +107,7 @@ class MangaparkChapterExtractor(MangaparkExtractor, ChapterExtractor):
data["manga"], _, data["type"] = data["manga"].rpartition(" ")
data["manga"] = text.unescape(data["manga"])
data["title"] = data["title"].partition(": ")[2]
data["count"] = util.safe_int(data["count"])
data["count"] = text.parse_int(data["count"])
return data
def get_images(self, page):