[ngomik] fix extraction

This commit is contained in:
Mike Fährmann
2019-05-30 19:51:34 +02:00
parent f1893b2b5b
commit 5499934ae2
3 changed files with 16 additions and 7 deletions

View File

@@ -176,7 +176,7 @@ class FlickrGalleryExtractor(FlickrExtractor):
test = (("https://www.flickr.com/photos/flickr/" test = (("https://www.flickr.com/photos/flickr/"
"galleries/72157681572514792/"), { "galleries/72157681572514792/"), {
"pattern": FlickrImageExtractor.pattern, "pattern": FlickrImageExtractor.pattern,
"count": 12, "count": ">= 10",
}) })
def __init__(self, match): def __init__(self, match):

View File

@@ -10,6 +10,7 @@
from .common import ChapterExtractor from .common import ChapterExtractor
from .. import text from .. import text
import re
class NgomikChapterExtractor(ChapterExtractor): class NgomikChapterExtractor(ChapterExtractor):
@@ -18,10 +19,15 @@ class NgomikChapterExtractor(ChapterExtractor):
root = "http://ngomik.in" root = "http://ngomik.in"
pattern = (r"(?:https?://)?(?:www\.)?ngomik\.in" pattern = (r"(?:https?://)?(?:www\.)?ngomik\.in"
r"(/[^/?&#]+-chapter-[^/?&#]+)") r"(/[^/?&#]+-chapter-[^/?&#]+)")
test = ("https://www.ngomik.in/14-sai-no-koi-chapter-1-6/", { test = (
"url": "8e67fdf751bbc79bc6f4dead7675008ddb8e32a4", ("https://www.ngomik.in/14-sai-no-koi-chapter-1-6/", {
"keyword": "204d177f09d438fd50c9c28d98c73289194640d8", "url": "8e67fdf751bbc79bc6f4dead7675008ddb8e32a4",
}) "keyword": "204d177f09d438fd50c9c28d98c73289194640d8",
}),
("https://ngomik.in/break-blade-chapter-26/", {
"count": 34,
}),
)
def metadata(self, page): def metadata(self, page):
info = text.extract(page, '<title>', "</title>")[0] info = text.extract(page, '<title>', "</title>")[0]
@@ -38,8 +44,8 @@ class NgomikChapterExtractor(ChapterExtractor):
@staticmethod @staticmethod
def images(page): def images(page):
readerarea = text.extract(page, 'id="readerarea"', 'class="chnav"')[0] readerarea = text.extract(page, 'id=readerarea', 'class=chnav')[0]
return [ return [
(text.unescape(url), None) (text.unescape(url), None)
for url in text.extract_iter(readerarea, ' src="', '"') for url in re.findall(r"\ssrc=[\"']?([^\"' >]+)", readerarea)
] ]

View File

@@ -21,11 +21,14 @@ TRAVIS_SKIP = {
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie", "bobx", "exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie", "bobx",
"archivedmoe", "archiveofsins", "thebarchive", "fireden", "4plebs", "archivedmoe", "archiveofsins", "thebarchive", "fireden", "4plebs",
"sankaku", "idolcomplex", "mangahere", "readcomiconline", "mangadex", "sankaku", "idolcomplex", "mangahere", "readcomiconline", "mangadex",
"sankakucomplex",
} }
# temporary issues, etc. # temporary issues, etc.
BROKEN = { BROKEN = {
"mangapark", "mangapark",
"simplyhentai",
"wallhaven",
} }