aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/batoto.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/batoto.py')
-rw-r--r--gallery_dl/extractor/batoto.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/gallery_dl/extractor/batoto.py b/gallery_dl/extractor/batoto.py
index a1ad3ae..50e0c5d 100644
--- a/gallery_dl/extractor/batoto.py
+++ b/gallery_dl/extractor/batoto.py
@@ -7,8 +7,7 @@
"""Extractors for https://bato.to/"""
from .common import Extractor, ChapterExtractor, MangaExtractor
-from .. import text, exception
-import re
+from .. import text, util
BASE_PATTERN = (r"(?:https?://)?("
r"(?:ba|d|f|h|j|m|w)to\.to|"
@@ -87,7 +86,7 @@ class BatotoChapterExtractor(BatotoBase, ChapterExtractor):
ChapterExtractor.__init__(self, match, False)
self._init_root()
self.chapter_id = self.groups[1]
- self.gallery_url = "{}/title/0/{}".format(self.root, self.chapter_id)
+ self.page_url = f"{self.root}/title/0/{self.chapter_id}"
def metadata(self, page):
extr = text.extract_from(page)
@@ -104,9 +103,9 @@ class BatotoChapterExtractor(BatotoBase, ChapterExtractor):
info = text.remove_html(extr('link-hover">', "</"))
info = text.unescape(info)
- match = re.match(
+ match = util.re(
r"(?i)(?:(?:Volume|S(?:eason)?)\s*(\d+)\s+)?"
- r"(?:Chapter|Episode)\s*(\d+)([\w.]*)", info)
+ r"(?:Chapter|Episode)\s*(\d+)([\w.]*)").match(info)
if match:
volume, chapter, minor = match.groups()
else:
@@ -148,14 +147,13 @@ class BatotoMangaExtractor(BatotoBase, MangaExtractor):
MangaExtractor.__init__(self, match, False)
self._init_root()
self.manga_id = self.groups[1] or self.groups[2]
- self.manga_url = "{}/title/{}".format(self.root, self.manga_id)
+ self.page_url = f"{self.root}/title/{self.manga_id}"
def chapters(self, page):
extr = text.extract_from(page)
- warning = extr(' class="alert alert-warning">', "</div><")
- if warning:
- raise exception.StopExtraction("'%s'", text.remove_html(warning))
+ if warning := extr(' class="alert alert-warning">', "</div>"):
+ self.log.warning("'%s'", text.remove_html(warning))
data = {
"manga_id": text.parse_int(self.manga_id),
@@ -178,6 +176,6 @@ class BatotoMangaExtractor(BatotoBase, MangaExtractor):
data["date"] = text.parse_datetime(
extr('time="', '"'), "%Y-%m-%dT%H:%M:%S.%fZ")
- url = "{}/title/{}".format(self.root, href)
+ url = f"{self.root}/title/{href}"
results.append((url, data.copy()))
return results