[mangapark] fix extraction

This commit is contained in:
Mike Fährmann
2019-01-17 21:21:57 +01:00
parent 8aba2bdebf
commit 66460337f1
3 changed files with 15 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
# -*- 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
@@ -10,6 +10,7 @@
from .common import ChapterExtractor, MangaExtractor
from .. import text, exception
import json
class MangaparkExtractor():
@@ -112,7 +113,6 @@ class MangaparkChapterExtractor(MangaparkExtractor, ChapterExtractor):
("path" , "var _book_link = '", "'"),
("manga" , "<h2>", "</h2>"),
("title" , "</a>", "<"),
("count" , 'page 1">1 / ', '<'),
), values={"lang": "en", "language": "English"})[0]
if not data["path"]:
@@ -122,20 +122,18 @@ class MangaparkChapterExtractor(MangaparkExtractor, ChapterExtractor):
data["manga"], _, data["type"] = data["manga"].rpartition(" ")
data["manga"] = text.unescape(data["manga"])
data["title"] = data["title"].partition(": ")[2]
for key in ("manga_id", "chapter_id", "stream", "count"):
for key in ("manga_id", "chapter_id", "stream"):
data[key] = text.parse_int(data[key])
return data
def get_images(self, page):
pos = 0
while True:
url, pos = text.extract(page, ' target="_blank" href="', '"', pos)
if not url:
return
width , pos = text.extract(page, ' width="', '"', pos)
height, pos = text.extract(page, ' _heighth="', '"', pos)
yield text.urljoin(self.root, url), {
"width": text.parse_int(width),
"height": text.parse_int(height),
}
data = json.loads(text.extract(
page, "var _load_pages =", ";")[0] or "[]")
return [
(text.urljoin(self.root, item["u"]), {
"width": text.parse_int(item["w"]),
"height": text.parse_int(item["h"]),
})
for item in data
]

View File

@@ -131,7 +131,8 @@ class NewgroundsVideoExtractor(NewgroundsExtractor):
filename_fmt = "{category}_{index}.{extension}"
pattern = [r"(?:https?://)?([^.]+)\.newgrounds\.com/movies/?$"]
test = [("https://twistedgrim.newgrounds.com/movies", {
"url": "618a8f01f35dae140bd0a7fe071f437497555c8f",
"pattern": r"ytdl:https?://www\.newgrounds\.com/portal/view/\d+",
"count": ">= 29",
})]
def get_page_urls(self):

View File

@@ -24,8 +24,8 @@ TRAVIS_SKIP = {
# temporary issues, etc.
BROKEN = {
"desuarchive",
"mangahere",
"rbt",
"simplyhentai",
}