@@ -1459,6 +1459,29 @@ Description
|
|||||||
* ``false``: Get posts from "Latest Updates" pages
|
* ``false``: Get posts from "Latest Updates" pages
|
||||||
|
|
||||||
|
|
||||||
|
extractor.batoto.domain
|
||||||
|
-----------------------
|
||||||
|
Type
|
||||||
|
``string``
|
||||||
|
Default
|
||||||
|
``"auto"``
|
||||||
|
Example
|
||||||
|
``"mangatoto.org"``
|
||||||
|
Description
|
||||||
|
Specifies the domain used by ``batoto`` extractors.
|
||||||
|
|
||||||
|
``"auto"`` | ``"url"``
|
||||||
|
Use the input URL's domain
|
||||||
|
``"nolegacy"``
|
||||||
|
Use the input URL's domain
|
||||||
|
- replace legacy domains with ``"xbato.org"``
|
||||||
|
``"nowarn"``
|
||||||
|
Use the input URL's domain
|
||||||
|
- do not warn about legacy domains
|
||||||
|
any ``string``
|
||||||
|
Use this domain
|
||||||
|
|
||||||
|
|
||||||
extractor.bbc.width
|
extractor.bbc.width
|
||||||
-------------------
|
-------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -117,6 +117,10 @@
|
|||||||
|
|
||||||
"recursive": true
|
"recursive": true
|
||||||
},
|
},
|
||||||
|
"batoto":
|
||||||
|
{
|
||||||
|
"domain": "auto"
|
||||||
|
},
|
||||||
"bbc":
|
"bbc":
|
||||||
{
|
{
|
||||||
"width": 1920
|
"width": 1920
|
||||||
|
|||||||
@@ -54,11 +54,23 @@ class BatotoBase():
|
|||||||
"""Base class for batoto extractors"""
|
"""Base class for batoto extractors"""
|
||||||
category = "batoto"
|
category = "batoto"
|
||||||
root = "https://xbato.org"
|
root = "https://xbato.org"
|
||||||
|
_warn_legacy = True
|
||||||
|
|
||||||
def _init_root(self, match):
|
def _init_root(self):
|
||||||
domain = match.group(1)
|
domain = self.config("domain")
|
||||||
if domain not in LEGACY_DOMAINS:
|
if domain is None or domain in {"auto", "url"}:
|
||||||
self.root = "https://" + domain
|
domain = self.groups[0]
|
||||||
|
if domain in LEGACY_DOMAINS:
|
||||||
|
if self._warn_legacy:
|
||||||
|
BatotoBase._warn_legacy = False
|
||||||
|
self.log.warning("Legacy domain '%s'", domain)
|
||||||
|
elif domain == "nolegacy":
|
||||||
|
domain = self.groups[0]
|
||||||
|
if domain in LEGACY_DOMAINS:
|
||||||
|
domain = "xbato.org"
|
||||||
|
elif domain == "nowarn":
|
||||||
|
domain = self.groups[0]
|
||||||
|
self.root = "https://" + domain
|
||||||
|
|
||||||
def request(self, url, **kwargs):
|
def request(self, url, **kwargs):
|
||||||
kwargs["encoding"] = "utf-8"
|
kwargs["encoding"] = "utf-8"
|
||||||
@@ -72,10 +84,10 @@ class BatotoChapterExtractor(BatotoBase, ChapterExtractor):
|
|||||||
example = "https://xbato.org/title/12345-MANGA/54321"
|
example = "https://xbato.org/title/12345-MANGA/54321"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
self._init_root(match)
|
ChapterExtractor.__init__(self, match, False)
|
||||||
self.chapter_id = match.group(2)
|
self._init_root()
|
||||||
url = "{}/title/0/{}".format(self.root, self.chapter_id)
|
self.chapter_id = self.groups[1]
|
||||||
ChapterExtractor.__init__(self, match, url)
|
self.gallery_url = "{}/title/0/{}".format(self.root, self.chapter_id)
|
||||||
|
|
||||||
def metadata(self, page):
|
def metadata(self, page):
|
||||||
extr = text.extract_from(page)
|
extr = text.extract_from(page)
|
||||||
@@ -133,10 +145,10 @@ class BatotoMangaExtractor(BatotoBase, MangaExtractor):
|
|||||||
example = "https://xbato.org/title/12345-MANGA/"
|
example = "https://xbato.org/title/12345-MANGA/"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
self._init_root(match)
|
MangaExtractor.__init__(self, match, False)
|
||||||
self.manga_id = match.group(2) or match.group(3)
|
self._init_root()
|
||||||
url = "{}/title/{}".format(self.root, self.manga_id)
|
self.manga_id = self.groups[1] or self.groups[2]
|
||||||
MangaExtractor.__init__(self, match, url)
|
self.manga_url = "{}/title/{}".format(self.root, self.manga_id)
|
||||||
|
|
||||||
def chapters(self, page):
|
def chapters(self, page):
|
||||||
extr = text.extract_from(page)
|
extr = text.extract_from(page)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ __tests__ = (
|
|||||||
"#url" : "https://bato.to/title/113742-futsutsuka-na-akujo-de-wa-gozaimasu-ga-suuguu-chouso-torikae-den-official",
|
"#url" : "https://bato.to/title/113742-futsutsuka-na-akujo-de-wa-gozaimasu-ga-suuguu-chouso-torikae-den-official",
|
||||||
"#category": ("", "batoto", "manga"),
|
"#category": ("", "batoto", "manga"),
|
||||||
"#class" : batoto.BatotoMangaExtractor,
|
"#class" : batoto.BatotoMangaExtractor,
|
||||||
|
"#options" : {"domain": "xbato.org"},
|
||||||
"#count" : ">= 21",
|
"#count" : ">= 21",
|
||||||
|
|
||||||
"chapter" : int,
|
"chapter" : int,
|
||||||
|
|||||||
Reference in New Issue
Block a user