From 49a05c32ed5df97bb1436bf4b44158e6787882fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 19 Sep 2016 16:15:27 +0200 Subject: [PATCH] add missing tests --- gallery_dl/extractor/4chan.py | 5 +++++ gallery_dl/extractor/8chan.py | 5 +++++ gallery_dl/extractor/batoto.py | 2 +- gallery_dl/extractor/exhentai.py | 4 ++++ gallery_dl/extractor/khinsider.py | 14 +++++++++++--- gallery_dl/extractor/mangapark.py | 4 ++-- gallery_dl/extractor/sankaku.py | 4 ++++ 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/gallery_dl/extractor/4chan.py b/gallery_dl/extractor/4chan.py index 8ae1b331..0debac33 100644 --- a/gallery_dl/extractor/4chan.py +++ b/gallery_dl/extractor/4chan.py @@ -15,6 +15,11 @@ class FourchanThreadExtractor(ChanExtractor): category = "4chan" subcategory = "thread" pattern = [r"(?:https?://)?boards\.4chan\.org/([^/]+)/thread/(\d+)"] + test = [("https://boards.4chan.org/tg/thread/15396072/", { + "url": "39082ad166161966d7ba8e37f2173a824eb540f0", + "keyword": "9b610fd3674653728516c34ec65925a024cc0074", + "content": "3081ed85a5afaeb3f430f42540e7bb5eec1908cc", + })] api_url = "https://a.4cdn.org/{board}/thread/{thread}.json" file_url = "https://i.4cdn.org/{board}/{tim}{ext}" diff --git a/gallery_dl/extractor/8chan.py b/gallery_dl/extractor/8chan.py index 8c7fa4f0..ebfa31f2 100644 --- a/gallery_dl/extractor/8chan.py +++ b/gallery_dl/extractor/8chan.py @@ -15,6 +15,11 @@ class InfinitychanThreadExtractor(ChanExtractor): category = "8chan" subcategory = "thread" pattern = [r"(?:https?://)?(?:www\.)?8ch\.net/([^/]+)/res/(\d+)"] + test = [("https://8ch.net/tg/res/175887.html", { + "url": "cb03fdc650ad8e796fdab553fbd5489f468d3f45", + "keyword": "d9388d231db6a0ea3e710a6cf46dc53dbdbb2115", + "content": "9f51cdfee6942a18011996ca049baeb0a22f931b", + })] api_url = "https://8ch.net/{board}/res/{thread}.json" file_url = "https://8ch.net/{board}/src/{tim}{ext}" diff --git a/gallery_dl/extractor/batoto.py b/gallery_dl/extractor/batoto.py index 1111c303..37e78e6a 100644 --- a/gallery_dl/extractor/batoto.py +++ b/gallery_dl/extractor/batoto.py @@ -21,7 +21,7 @@ class BatotoChapterExtractor(AsynchronousExtractor): pattern = [r"(?:https?://)?(?:www\.)?bato\.to/reader#([0-9a-f]+)"] test = [("http://bato.to/reader#459878c8fda07502", { "url": "432d7958506ad913b0a9e42664a89e46a63e9296", - "keyword": "00727dd9e353581ec762b0b628dfcec1db5cba68", + "keyword": "e34a9184a51266e4f1ab3c2a652a4359bb7e3d30", })] url = "https://bato.to/areader" diff --git a/gallery_dl/extractor/exhentai.py b/gallery_dl/extractor/exhentai.py index ca5f92cd..39fdda7c 100644 --- a/gallery_dl/extractor/exhentai.py +++ b/gallery_dl/extractor/exhentai.py @@ -21,6 +21,10 @@ class ExhentaiGalleryExtractor(Extractor): directory_fmt = ["{category}", "{gallery-id}"] filename_fmt = "{gallery-id}_{num:>04}_{imgkey}_{name}.{extension}" pattern = [r"(?:https?://)?(g\.e-|ex)hentai\.org/g/(\d+)/([\da-f]{10})"] + test = [("https://exhentai.org/g/960460/4f0e369d82/", { + "keyword": "aaac45cad1897a9815384bc3a743ce7502c692f6", + "content": "493d759de534355c9f55f8e365565b62411de146", + })] api_url = "https://exhentai.org/api.php" def __init__(self, match): diff --git a/gallery_dl/extractor/khinsider.py b/gallery_dl/extractor/khinsider.py index caf3ec3d..cf359bab 100644 --- a/gallery_dl/extractor/khinsider.py +++ b/gallery_dl/extractor/khinsider.py @@ -6,10 +6,10 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -"""Extract soundtracks from https://khinsider.com/""" +"""Extract soundtracks from http://khinsider.com/""" from .common import AsynchronousExtractor, Message -from .. import text +from .. import text, exception class KhinsiderSoundtrackExtractor(AsynchronousExtractor): """Extractor for soundtracks from khinsider.com""" @@ -18,6 +18,10 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor): directory_fmt = ["{category}", "{album}"] filename_fmt = "{filename}" pattern = [r"(?:https?://)?downloads\.khinsider\.com/game-soundtracks/album/(.+)"] + test = [("http://downloads.khinsider.com/game-soundtracks/album/horizon-riders-wii-", { + "url": "35ff4c8310884664408dc5560fda3b06157f7606", + "keyword": "dde50e1f5dbed5ee3f13df4e1bffc58bb9563f22", + })] def __init__(self, match): AsynchronousExtractor.__init__(self) @@ -34,6 +38,7 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor): yield Message.Url, url, track def get_job_metadata(self, page): + """Collect metadata for extractor-job""" return text.extract_all(page, ( ("album", "Album name: ", ""), ("count", "Number of Files: ", ""), @@ -43,7 +48,10 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor): ), values={"category": self.category})[0] def get_album_tracks(self, page): - pos = page.index("Download all songs at once:") + """Collect url and metadata for all tracks of a soundtrack""" + pos = page.find("Download all songs at once:") + if pos == -1: + raise exception.NotFoundError("soundtrack") num = 0 for url in text.extract_iter(page, '\r\n\t\t