aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/komikcast.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/komikcast.py')
-rw-r--r--gallery_dl/extractor/komikcast.py37
1 files changed, 16 insertions, 21 deletions
diff --git a/gallery_dl/extractor/komikcast.py b/gallery_dl/extractor/komikcast.py
index 89a1b5e..816bc3d 100644
--- a/gallery_dl/extractor/komikcast.py
+++ b/gallery_dl/extractor/komikcast.py
@@ -1,36 +1,32 @@
# -*- coding: utf-8 -*-
-# Copyright 2018-2023 Mike Fährmann
+# Copyright 2018-2025 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
# published by the Free Software Foundation.
-"""Extractors for https://komikcast.la/"""
+"""Extractors for https://komikcast.li/"""
from .common import ChapterExtractor, MangaExtractor
-from .. import text
-import re
+from .. import text, util
BASE_PATTERN = (r"(?:https?://)?(?:www\.)?"
- r"komikcast\.(?:la|cz|lol|site|mo?e|com)")
+ r"komikcast\d*\.(?:l(?:i|a|ol)|com|cz|site|mo?e)")
class KomikcastBase():
"""Base class for komikcast extractors"""
category = "komikcast"
- root = "https://komikcast.la"
+ root = "https://komikcast.li"
- @staticmethod
- def parse_chapter_string(chapter_string, data=None):
+ def parse_chapter_string(self, chapter_string, data=None):
"""Parse 'chapter_string' value and add its info to 'data'"""
- if not data:
+ if data is None:
data = {}
- match = re.match(
- r"(?:(.*) Chapter )?0*(\d+)([^ ]*)(?: (?:- )?(.+))?",
- text.unescape(chapter_string),
- )
+ pattern = util.re(r"(?:(.*) Chapter )?0*(\d+)([^ ]*)(?: (?:- )?(.+))?")
+ match = pattern.match(text.unescape(chapter_string))
manga, chapter, data["chapter_minor"], title = match.groups()
if manga:
@@ -49,27 +45,27 @@ class KomikcastBase():
class KomikcastChapterExtractor(KomikcastBase, ChapterExtractor):
"""Extractor for komikcast manga chapters"""
pattern = BASE_PATTERN + r"(/chapter/[^/?#]+/)"
- example = "https://komikcast.la/chapter/TITLE/"
+ example = "https://komikcast.li/chapter/TITLE/"
def metadata(self, page):
info = text.extr(page, "<title>", " - Komikcast<")
return self.parse_chapter_string(info)
- @staticmethod
- def images(page):
+ def images(self, page):
readerarea = text.extr(
page, '<div class="main-reading-area', '</div')
+ pattern = util.re(r"<img[^>]* src=[\"']([^\"']+)")
return [
(text.unescape(url), None)
- for url in re.findall(r"<img[^>]* src=[\"']([^\"']+)", readerarea)
+ for url in pattern.findall(readerarea)
]
class KomikcastMangaExtractor(KomikcastBase, MangaExtractor):
"""Extractor for komikcast manga"""
chapterclass = KomikcastChapterExtractor
- pattern = BASE_PATTERN + r"(/(?:komik/)?[^/?#]+)/?$"
- example = "https://komikcast.la/komik/TITLE"
+ pattern = BASE_PATTERN + r"(/(?:komik/)?[^/?#]+/?)$"
+ example = "https://komikcast.li/komik/TITLE"
def chapters(self, page):
results = []
@@ -84,8 +80,7 @@ class KomikcastMangaExtractor(KomikcastBase, MangaExtractor):
results.append((url, data.copy()))
return results
- @staticmethod
- def metadata(page):
+ def metadata(self, page):
"""Return a dict with general metadata"""
manga , pos = text.extract(page, "<title>" , " - Komikcast<")
genres, pos = text.extract(