[mangashare] add manga-extractor
This commit is contained in:
@@ -6,13 +6,37 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
"""Extract manga pages from http://www.mangashare.com/"""
|
||||
"""Extract manga-chapters and entire manga from http://www.mangashare.com/"""
|
||||
|
||||
from .common import AsynchronousExtractor, Message
|
||||
from .common import Extractor, AsynchronousExtractor, Message
|
||||
from .. import text
|
||||
|
||||
class MangaShareExtractor(AsynchronousExtractor):
|
||||
class MangaShareMangaExtractor(Extractor):
|
||||
"""Extract all manga-chapters from mangashare"""
|
||||
category = "mangashare"
|
||||
directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"]
|
||||
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
|
||||
pattern = [r"(?:https?://)?read\.mangashare\.com/[^/]+$"]
|
||||
|
||||
def __init__(self, match):
|
||||
Extractor.__init__(self)
|
||||
self.url = match.group(0)
|
||||
|
||||
def items(self):
|
||||
yield Message.Version, 1
|
||||
for chapter in self.get_chapters():
|
||||
yield Message.Queue, chapter
|
||||
|
||||
def get_chapters(self):
|
||||
"""Return a list of all chapter urls"""
|
||||
page = self.request(self.url).text
|
||||
return reversed(list(
|
||||
text.extract_iter(page, '<td class="datarow-0"><a href="', '"')
|
||||
))
|
||||
|
||||
|
||||
class MangaShareChapterExtractor(AsynchronousExtractor):
|
||||
"""Extract a single manga-chapter from mangashare"""
|
||||
category = "mangashare"
|
||||
directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"]
|
||||
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
|
||||
|
||||
Reference in New Issue
Block a user