1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 04:32:51 +01:00

[mangafox] fix extraction

use mobile version since desktop version is obfuscated
This commit is contained in:
Mike Fährmann 2018-11-26 16:10:53 +01:00
parent a4263fb253
commit 15890930ea
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 23 additions and 25 deletions

View File

@ -9,15 +9,14 @@
"""Extract manga-chapters and entire manga from http://fanfox.net/""" """Extract manga-chapters and entire manga from http://fanfox.net/"""
from .common import ChapterExtractor from .common import ChapterExtractor
from .. import text, exception from .. import text
import re
class MangafoxChapterExtractor(ChapterExtractor): class MangafoxChapterExtractor(ChapterExtractor):
"""Extractor for manga-chapters from fanfox.net""" """Extractor for manga-chapters from fanfox.net"""
category = "mangafox" category = "mangafox"
pattern = [(r"(?:https?://)?(?:www\.)?(?:mangafox\.me|fanfox\.net)" pattern = [(r"(?:https?://)?(?:www\.|m\.)?(?:mangafox\.me|fanfox\.net)"
r"(/manga/[^/]+/(?:v\d+/)?c\d+[^/?&#]*)")] r"(/manga/[^/]+/((?:v(\d+)/)?c(\d+)([^/?&#]*)))")]
test = [ test = [
("http://fanfox.net/manga/kidou_keisatsu_patlabor/v05/c006.2/1.html", { ("http://fanfox.net/manga/kidou_keisatsu_patlabor/v05/c006.2/1.html", {
"keyword": "36b570e9ef11b4748407324fe08bebbe4856e6fd", "keyword": "36b570e9ef11b4748407324fe08bebbe4856e6fd",
@ -25,37 +24,37 @@ class MangafoxChapterExtractor(ChapterExtractor):
}), }),
("http://mangafox.me/manga/kidou_keisatsu_patlabor/v05/c006.2/", None), ("http://mangafox.me/manga/kidou_keisatsu_patlabor/v05/c006.2/", None),
] ]
root = "http://fanfox.net" root = "http://m.fanfox.net"
def __init__(self, match): def __init__(self, match):
self.urlbase = self.root + match.group(1) base, self.cstr, self.volume, self.chapter, self.minor = match.groups()
self.urlbase = self.root + base
ChapterExtractor.__init__(self, self.urlbase + "/1.html") ChapterExtractor.__init__(self, self.urlbase + "/1.html")
def get_metadata(self, page): def get_metadata(self, page):
if "Sorry, its licensed, and not available." in page: manga, pos = text.extract(page, "<title>", "</title>")
raise exception.AuthorizationError() count, pos = text.extract(
data = text.extract_all(page, ( page, ">", "<", page.find("</select>", pos) - 20)
("manga" , " - Read ", " Manga Scans "), sid , pos = text.extract(page, "var series_id =", ";", pos)
("sid" , "var sid=", ";"), cid , pos = text.extract(page, "var chapter_id =", ";", pos)
("cid" , "var cid=", ";"),
("count" , "var total_pages=", ";"), return {
("chapter_string", 'var current_chapter="', '"'), "manga": text.unescape(manga),
))[0] "volume": text.parse_int(self.volume),
match = re.match(r"(v0*(\d+)/)?c0*(\d+)(.*)", data["chapter_string"]) "chapter": text.parse_int(self.chapter),
data["volume"] = match.group(2) "chapter_minor": self.minor or "",
data["chapter"] = match.group(3) "chapter_string": self.cstr,
data["chapter_minor"] = match.group(4) or "" "count": text.parse_int(count),
data["manga"] = data["manga"].rpartition(" ")[0] "sid": text.parse_int(sid),
for key in ("sid", "cid", "count", "volume", "chapter"): "cid": text.parse_int(cid),
data[key] = text.parse_int(data[key]) }
return data
def get_images(self, page): def get_images(self, page):
pnum = 1 pnum = 1
while True: while True:
url, pos = text.extract(page, '<img src="', '"') url, pos = text.extract(page, '<img src="', '"')
yield url, None yield url, None
url, pos = text.extract(page, '<img src="', '"', pos) url, pos = text.extract(page, ' src="', '"', pos)
yield url, None yield url, None
pnum += 2 pnum += 2

View File

@ -24,7 +24,6 @@ TRAVIS_SKIP = {
# temporary issues, etc. # temporary issues, etc.
BROKEN = { BROKEN = {
"deviantart", "deviantart",
"mangafox",
} }