2018-08-23 15:29:53 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-02-08 13:45:40 +01:00
|
|
|
# Copyright 2018-2019 Mike Fährmann
|
2018-08-23 15:29:53 +02:00
|
|
|
#
|
|
|
|
# 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 and entire manga from http://ngomik.in/"""
|
|
|
|
|
|
|
|
from .common import ChapterExtractor
|
|
|
|
from .. import text
|
2019-05-30 19:51:34 +02:00
|
|
|
import re
|
2018-08-23 15:29:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
class NgomikChapterExtractor(ChapterExtractor):
|
|
|
|
"""Extractor for manga-chapters from ngomik.in"""
|
|
|
|
category = "ngomik"
|
|
|
|
root = "http://ngomik.in"
|
2019-02-08 13:45:40 +01:00
|
|
|
pattern = (r"(?:https?://)?(?:www\.)?ngomik\.in"
|
2019-02-11 18:38:47 +01:00
|
|
|
r"(/[^/?&#]+-chapter-[^/?&#]+)")
|
2019-05-30 19:51:34 +02:00
|
|
|
test = (
|
|
|
|
("https://www.ngomik.in/14-sai-no-koi-chapter-1-6/", {
|
|
|
|
"url": "8e67fdf751bbc79bc6f4dead7675008ddb8e32a4",
|
|
|
|
"keyword": "204d177f09d438fd50c9c28d98c73289194640d8",
|
|
|
|
}),
|
|
|
|
("https://ngomik.in/break-blade-chapter-26/", {
|
|
|
|
"count": 34,
|
|
|
|
}),
|
|
|
|
)
|
2018-08-23 15:29:53 +02:00
|
|
|
|
2019-02-11 18:38:47 +01:00
|
|
|
def metadata(self, page):
|
2018-08-23 15:29:53 +02:00
|
|
|
info = text.extract(page, '<title>', "</title>")[0]
|
2019-02-10 14:19:08 +01:00
|
|
|
manga, _, chapter = info.partition(" Chapter ")
|
|
|
|
chapter, sep, minor = chapter.partition(" ")[0].partition(".")
|
2018-08-23 15:29:53 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
"manga": text.unescape(manga),
|
|
|
|
"chapter": text.parse_int(chapter),
|
|
|
|
"chapter_minor": sep + minor,
|
|
|
|
"lang": "id",
|
|
|
|
"language": "Indonesian",
|
|
|
|
}
|
|
|
|
|
|
|
|
@staticmethod
|
2019-02-11 18:38:47 +01:00
|
|
|
def images(page):
|
2019-07-28 10:37:54 +02:00
|
|
|
readerarea = text.extract(page, 'id="readerarea"', 'class="chnav"')[0]
|
2018-08-23 15:29:53 +02:00
|
|
|
return [
|
2019-02-10 14:19:08 +01:00
|
|
|
(text.unescape(url), None)
|
2019-05-30 19:51:34 +02:00
|
|
|
for url in re.findall(r"\ssrc=[\"']?([^\"' >]+)", readerarea)
|
2018-08-23 15:29:53 +02:00
|
|
|
]
|