2016-09-22 17:20:57 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-02-08 13:45:40 +01:00
|
|
|
# Copyright 2015-2019 Mike Fährmann
|
2016-09-22 17:20:57 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2017-04-20 13:20:41 +02:00
|
|
|
"""Extract manga-chapters from https://dynasty-scans.com/"""
|
2016-09-22 17:20:57 +02:00
|
|
|
|
2018-02-03 23:14:32 +01:00
|
|
|
from .common import ChapterExtractor
|
2018-04-20 14:53:21 +02:00
|
|
|
from .. import text
|
2016-09-22 17:20:57 +02:00
|
|
|
import json
|
2019-02-11 18:38:47 +01:00
|
|
|
import re
|
2016-09-22 17:20:57 +02:00
|
|
|
|
2017-02-01 00:53:19 +01:00
|
|
|
|
2018-02-03 23:14:32 +01:00
|
|
|
class DynastyscansChapterExtractor(ChapterExtractor):
|
2016-09-22 17:20:57 +02:00
|
|
|
"""Extractor for manga-chapters from dynasty-scans.com"""
|
|
|
|
category = "dynastyscans"
|
2019-02-11 18:38:47 +01:00
|
|
|
pattern = r"(?:https?://)?(?:www\.)?dynasty-scans\.com(/chapters/[^/?&#]+)"
|
2019-02-08 13:45:40 +01:00
|
|
|
test = (
|
2017-02-01 00:53:19 +01:00
|
|
|
(("http://dynasty-scans.com/chapters/"
|
|
|
|
"hitoribocchi_no_oo_seikatsu_ch33"), {
|
2017-11-06 20:56:49 +01:00
|
|
|
"url": "dce64e8c504118f1ab4135c00245ea12413896cb",
|
2019-02-14 16:07:17 +01:00
|
|
|
"keyword": "1564965671ac69bb7fbc340538397f6bd0aa269b",
|
2016-09-22 17:20:57 +02:00
|
|
|
}),
|
2017-02-01 00:53:19 +01:00
|
|
|
(("http://dynasty-scans.com/chapters/"
|
|
|
|
"new_game_the_spinoff_special_13"), {
|
2017-11-06 20:56:49 +01:00
|
|
|
"url": "dbe5bbb74da2edcfb1832895a484e2a40bc8b538",
|
2019-02-14 16:07:17 +01:00
|
|
|
"keyword": "22b35029bc65d6d95db2e2c147b0a37f2d290f29",
|
2016-09-22 17:20:57 +02:00
|
|
|
}),
|
2019-02-08 13:45:40 +01:00
|
|
|
)
|
2017-11-06 20:56:49 +01:00
|
|
|
root = "https://dynasty-scans.com"
|
2016-09-22 17:20:57 +02:00
|
|
|
|
2019-02-11 18:38:47 +01:00
|
|
|
def metadata(self, page):
|
2016-09-22 17:20:57 +02:00
|
|
|
info , pos = text.extract(page, "<h3 id='chapter-title'><b>", "</b>")
|
|
|
|
author, pos = text.extract(page, " by ", "</a>", pos)
|
2017-10-10 17:14:39 +02:00
|
|
|
group , pos = text.extract(page, '"icon-print"></i> ', '</span>', pos)
|
2017-02-01 00:53:19 +01:00
|
|
|
date , pos = text.extract(page, '"icon-calendar"></i> ', '<', pos)
|
2017-10-10 17:14:39 +02:00
|
|
|
|
2016-09-22 17:20:57 +02:00
|
|
|
match = re.match(
|
2017-10-10 17:14:39 +02:00
|
|
|
(r"(?:<a[^>]*>)?([^<]+)(?:</a>)?" # manga name
|
|
|
|
r"(?: ch(\d+)([^:<]*))?" # chapter info
|
|
|
|
r"(?:: (.+))?"), # title
|
2016-09-22 17:20:57 +02:00
|
|
|
info
|
|
|
|
)
|
2017-10-10 17:14:39 +02:00
|
|
|
|
2016-09-22 17:20:57 +02:00
|
|
|
return {
|
|
|
|
"manga": text.unescape(match.group(1)),
|
2018-04-20 14:53:21 +02:00
|
|
|
"chapter": text.parse_int(match.group(2)),
|
2017-10-10 17:14:39 +02:00
|
|
|
"chapter_minor": match.group(3) or "",
|
|
|
|
"title": text.unescape(match.group(4) or ""),
|
2016-09-22 17:20:57 +02:00
|
|
|
"author": text.remove_html(author),
|
2017-10-10 17:14:39 +02:00
|
|
|
"group": (text.remove_html(group) or
|
|
|
|
text.extract(group, ' alt="', '"')[0] or ""),
|
2016-09-22 17:20:57 +02:00
|
|
|
"date": date,
|
|
|
|
"lang": "en",
|
|
|
|
"language": "English",
|
|
|
|
}
|
|
|
|
|
2019-02-11 18:38:47 +01:00
|
|
|
def images(self, page):
|
2016-09-22 17:20:57 +02:00
|
|
|
data = text.extract(page, "var pages = ", ";\n")[0]
|
2018-02-03 23:14:32 +01:00
|
|
|
return [
|
|
|
|
(self.root + img["image"], None)
|
|
|
|
for img in json.loads(data)
|
|
|
|
]
|