summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/mangastream.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-07-02 04:33:45 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-07-02 04:33:45 -0400
commit195c45911e79c33cf0bb986721365fb06df5a153 (patch)
treeac0c9b6ef40bea7aa7ab0c5c3cb500eb510668fa /gallery_dl/extractor/mangastream.py
Import Upstream version 1.8.7upstream/1.8.7
Diffstat (limited to 'gallery_dl/extractor/mangastream.py')
-rw-r--r--gallery_dl/extractor/mangastream.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/gallery_dl/extractor/mangastream.py b/gallery_dl/extractor/mangastream.py
new file mode 100644
index 0000000..7ff0239
--- /dev/null
+++ b/gallery_dl/extractor/mangastream.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+# 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://readms.net/"""
+
+from .common import ChapterExtractor
+from .. import text
+
+
+class MangastreamChapterExtractor(ChapterExtractor):
+ """Extractor for manga-chapters from mangastream.com"""
+ category = "mangastream"
+ archive_fmt = "{chapter_id}_{page}"
+ pattern = (r"(?:https?://)?(?:www\.)?(?:readms\.net|mangastream\.com)"
+ r"/r(?:ead)?/([^/]*/([^/]+)/(\d+))")
+ test = (
+ ("https://readms.net/r/onepunch_man/087/4874/1"),
+ ("https://mangastream.com/r/onepunch_man/087/4874/1"),
+ )
+ root = "https://readms.net"
+
+ def __init__(self, match):
+ self.part, self.chapter, self.chapter_id = match.groups()
+ url = "{}/r/{}".format(self.root, self.part)
+ ChapterExtractor.__init__(self, match, url)
+
+ def metadata(self, page):
+ manga, pos = text.extract(
+ page, '<span class="hidden-xs hidden-sm">', "<")
+ pos = page.find(self.part, pos)
+ title, pos = text.extract(page, ' - ', '<', pos)
+ count, pos = text.extract(page, 'Last Page (', ')', pos)
+ return {
+ "manga": manga,
+ "chapter": text.unquote(self.chapter),
+ "chapter_id": text.parse_int(self.chapter_id),
+ "title": title,
+ "count": text.parse_int(count, 1),
+ "lang": "en",
+ "language": "English",
+ }
+
+ def images(self, page):
+ while True:
+ 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.root, image_url), None
+ page = self.request(text.urljoin(self.root, next_url)).text