update URLs for supportedsites.rst

This commit is contained in:
Mike Fährmann
2019-01-30 16:18:22 +01:00
parent 80a75a1ecf
commit 6126615698
11 changed files with 44 additions and 40 deletions

View File

@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2018 Mike Fährmann
# Copyright 2015-2019 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://mangastream.com/"""
"""Extract manga-chapters from https://readms.net/"""
from .common import ChapterExtractor
from .. import text
@@ -16,14 +16,18 @@ class MangastreamChapterExtractor(ChapterExtractor):
"""Extractor for manga-chapters from mangastream.com"""
category = "mangastream"
archive_fmt = "{chapter_id}_{page}"
pattern = [(r"(?:https?://)?(?:www\.)?(?:readms|mangastream)\.(?:com|net)/"
pattern = [(r"(?:https?://)?(?:www\.)?(?:readms\.net|mangastream\.com)/"
r"r(?:ead)?/([^/]*/([^/]+)/(\d+))")]
test = [("https://readms.net/r/onepunch_man/087/4874/1", None)]
base_url = "https://readms.net/r/"
test = [
("https://readms.net/r/onepunch_man/087/4874/1", None),
("https://mangastream.com/r/onepunch_man/087/4874/1", None),
]
root = "https://readms.net"
def __init__(self, match):
self.part, self.chapter, self.ch_id = match.groups()
ChapterExtractor.__init__(self, self.base_url + self.part)
self.part, self.chapter, self.chapter_id = match.groups()
url = "{}/r/{}".format(self.root, self.part)
ChapterExtractor.__init__(self, url)
def get_metadata(self, page):
manga, pos = text.extract(
@@ -34,7 +38,7 @@ class MangastreamChapterExtractor(ChapterExtractor):
return {
"manga": manga,
"chapter": text.unquote(self.chapter),
"chapter_id": text.parse_int(self.ch_id),
"chapter_id": text.parse_int(self.chapter_id),
"title": title,
"count": text.parse_int(count, 1),
"lang": "en",
@@ -46,5 +50,5 @@ class MangastreamChapterExtractor(ChapterExtractor):
pos = page.index(' class="page"')
next_url = text.extract(page, ' href="', '"', pos)[0]
image_url = text.extract(page, ' src="', '"', pos)[0]
yield text.urljoin(self.base_url, image_url), None
page = self.request(text.urljoin(self.base_url, next_url)).text
yield text.urljoin(self.root, image_url), None
page = self.request(text.urljoin(self.root, next_url)).text