[mangafox] extract more metadata (#3167)
This commit is contained in:
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
from .common import ChapterExtractor, MangaExtractor
|
from .common import ChapterExtractor, MangaExtractor
|
||||||
from .. import text
|
from .. import text
|
||||||
import re
|
|
||||||
|
|
||||||
BASE_PATTERN = r"(?:https?://)?(?:www\.|m\.)?(?:fanfox\.net|mangafox\.me)"
|
BASE_PATTERN = r"(?:https?://)?(?:www\.|m\.)?(?:fanfox\.net|mangafox\.me)"
|
||||||
|
|
||||||
@@ -44,14 +43,14 @@ class MangafoxChapterExtractor(ChapterExtractor):
|
|||||||
cid , pos = text.extract(page, "var chapter_id =", ";", pos)
|
cid , pos = text.extract(page, "var chapter_id =", ";", pos)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"manga": text.unescape(manga),
|
"manga" : text.unescape(manga),
|
||||||
"volume": text.parse_int(self.volume),
|
"volume" : text.parse_int(self.volume),
|
||||||
"chapter": text.parse_int(self.chapter),
|
"chapter" : text.parse_int(self.chapter),
|
||||||
"chapter_minor": self.minor or "",
|
"chapter_minor" : self.minor or "",
|
||||||
"chapter_string": self.cstr,
|
"chapter_string": self.cstr,
|
||||||
"count": text.parse_int(count),
|
"count" : text.parse_int(count),
|
||||||
"sid": text.parse_int(sid),
|
"sid" : text.parse_int(sid),
|
||||||
"cid": text.parse_int(cid),
|
"cid" : text.parse_int(cid),
|
||||||
}
|
}
|
||||||
|
|
||||||
def images(self, page):
|
def images(self, page):
|
||||||
@@ -76,6 +75,25 @@ class MangafoxMangaExtractor(MangaExtractor):
|
|||||||
("https://fanfox.net/manga/kanojo_mo_kanojo", {
|
("https://fanfox.net/manga/kanojo_mo_kanojo", {
|
||||||
"pattern": MangafoxChapterExtractor.pattern,
|
"pattern": MangafoxChapterExtractor.pattern,
|
||||||
"count": ">=60",
|
"count": ">=60",
|
||||||
|
"keyword": {
|
||||||
|
"author": "HIROYUKI",
|
||||||
|
"chapter": int,
|
||||||
|
"chapter_minor": r"re:^(\.\d+)?$",
|
||||||
|
"chapter_string": r"re:(v\d+/)?c\d+",
|
||||||
|
"date": "type:datetime",
|
||||||
|
"description": "High school boy Naoya gets a confession from M"
|
||||||
|
"omi, a cute and friendly girl. However, Naoya "
|
||||||
|
"already has a girlfriend, Seki... but Momi is "
|
||||||
|
"too good a catch to let go. Momi and Nagoya's "
|
||||||
|
"goal becomes clear: convince Seki to accept be"
|
||||||
|
"ing an item with the two of them. Will she bud"
|
||||||
|
"ge?",
|
||||||
|
"lang": "en",
|
||||||
|
"language": "English",
|
||||||
|
"manga": "Kanojo mo Kanojo",
|
||||||
|
"tags": ["Comedy", "Romance", "School Life", "Shounen"],
|
||||||
|
"volume": int,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
("https://mangafox.me/manga/shangri_la_frontier", {
|
("https://mangafox.me/manga/shangri_la_frontier", {
|
||||||
"pattern": MangafoxChapterExtractor.pattern,
|
"pattern": MangafoxChapterExtractor.pattern,
|
||||||
@@ -85,34 +103,41 @@ class MangafoxMangaExtractor(MangaExtractor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def chapters(self, page):
|
def chapters(self, page):
|
||||||
match_info = re.compile(r"Ch (\d+)(\S*)(?: (.*))?").match
|
results = []
|
||||||
manga, pos = text.extract(page, '<p class="title">', '</p>')
|
chapter_match = MangafoxChapterExtractor.pattern.match
|
||||||
author, pos = text.extract(page, '<p>Author(s):', '</p>', pos)
|
|
||||||
|
extr = text.extract_from(page)
|
||||||
|
manga = extr('<p class="title">', '</p>')
|
||||||
|
author = extr('<p>Author(s):', '</p>')
|
||||||
|
extr('<dd class="chlist">', '')
|
||||||
|
|
||||||
|
genres, _, summary = text.extr(
|
||||||
|
page, '<div class="manga-genres">', '</section>'
|
||||||
|
).partition('<div class="manga-summary">')
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"manga" : text.unescape(manga),
|
"manga" : text.unescape(manga),
|
||||||
"author" : text.remove_html(author),
|
"author" : text.remove_html(author),
|
||||||
"lang" : "en",
|
"description": text.unescape(text.remove_html(summary)),
|
||||||
"language": "English",
|
"tags" : text.split_html(genres),
|
||||||
|
"lang" : "en",
|
||||||
|
"language" : "English",
|
||||||
}
|
}
|
||||||
|
|
||||||
results = []
|
|
||||||
pos = page.index('<dd class="chlist">')
|
|
||||||
while True:
|
while True:
|
||||||
url, pos = text.extract(page, '<a href="//', '"', pos)
|
url = "https://" + extr('<a href="//', '"')
|
||||||
if url == 'mangafox.la?f=mobile':
|
match = chapter_match(url)
|
||||||
|
if not match:
|
||||||
return results
|
return results
|
||||||
info, pos = text.extract(page, '>', '<span', pos)
|
_, cstr, volume, chapter, minor = match.groups()
|
||||||
date, pos = text.extract(page, 'right">', '</span>', pos)
|
|
||||||
|
|
||||||
match = match_info(text.unescape(info))
|
chapter = {
|
||||||
if match:
|
"volume" : text.parse_int(volume),
|
||||||
chapter, minor, title = match.groups()
|
"chapter" : text.parse_int(chapter),
|
||||||
chapter_minor = minor
|
"chapter_minor" : minor or "",
|
||||||
else:
|
"chapter_string": cstr,
|
||||||
chapter, _, minor = url[:-7].rpartition("/c")[2].partition(".")
|
"date" : text.parse_datetime(
|
||||||
chapter_minor = "." + minor
|
extr('right">', '</span>'), "%b %d, %Y"),
|
||||||
|
}
|
||||||
data["chapter"] = text.parse_int(chapter)
|
chapter.update(data)
|
||||||
data["chapter_minor"] = chapter_minor if minor else ""
|
results.append((url, chapter))
|
||||||
data["date"] = date
|
|
||||||
results.append(("https://" + url, data.copy()))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user