[gomanga] add chapter extractor
This commit is contained in:
parent
911d2f080b
commit
cfe5bf732a
@ -23,6 +23,7 @@ modules = [
|
||||
"e621",
|
||||
"exhentai",
|
||||
"gelbooru",
|
||||
"gomanga",
|
||||
"hbrowse",
|
||||
"hentai2read",
|
||||
"hentaibox",
|
||||
|
@ -18,6 +18,7 @@ class FoolslideChapterExtractor(Extractor):
|
||||
subcategory = "chapter"
|
||||
directory_fmt = ["{category}", "{manga}", "{chapter:>03} - {title}"]
|
||||
filename_fmt = "{manga}_{chapter:>03}_{page:>03}.{extension}"
|
||||
single = True
|
||||
|
||||
def __init__(self, url, lang):
|
||||
Extractor.__init__(self)
|
||||
@ -61,7 +62,12 @@ class FoolslideChapterExtractor(Extractor):
|
||||
"title": text.unescape(parts[1].strip() if len(parts) > 1 else ""),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def get_images(page):
|
||||
def get_images(self, page):
|
||||
"""Return a list of all images in this chapter"""
|
||||
return json.loads(text.extract(page, 'var pages = ', ';')[0])
|
||||
if self.single:
|
||||
pos = 0
|
||||
needle = "var pages = "
|
||||
else:
|
||||
pos = page.find("[{")
|
||||
needle = " = "
|
||||
return json.loads(text.extract(page, needle, ";", pos)[0])
|
||||
|
26
gallery_dl/extractor/gomanga.py
Normal file
26
gallery_dl/extractor/gomanga.py
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2017 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.
|
||||
|
||||
"""Extract manga-chapters from https://gomanga.co/"""
|
||||
|
||||
from .foolslide import FoolslideChapterExtractor
|
||||
|
||||
class GomangaChapterExtractor(FoolslideChapterExtractor):
|
||||
"""Extractor for manga-chapters from gomanga.co"""
|
||||
category = "gomanga"
|
||||
pattern = [(r"(?:https?://)?(?:www\.)?(gomanga\.co/reader/read/"
|
||||
r"[^/]+/([a-z]{2})/\d+/\d+)")]
|
||||
test = [("https://gomanga.co/reader/read/mata-kata-omou/en/0/1/page/11", {
|
||||
"url": "5088d75bb44327fc503c85b52b1d6a371b8057f2",
|
||||
"keyword": "63f4d2cbbcaf3e7b5c48e71c4c4d453d9a399a26",
|
||||
})]
|
||||
single = False
|
||||
|
||||
def __init__(self, match):
|
||||
url = "https://" + match.group(1)
|
||||
FoolslideChapterExtractor.__init__(self, url, match.group(2))
|
Loading…
x
Reference in New Issue
Block a user