From ed4b3c48cb828e80bd8de3d33de455b4557a9a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 12 Aug 2021 16:05:26 +0200 Subject: [PATCH] fix flake8 and other tests --- docs/configuration.rst | 8 ++++---- docs/supportedsites.md | 6 ++++++ gallery_dl/extractor/luscious.py | 6 ++++-- gallery_dl/extractor/wikieat.py | 21 ++++++++++++--------- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 1acc39fc..b061bcfb 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1325,7 +1325,7 @@ Description extractor.luscious.gif --------------------------- +---------------------- Type ``bool`` Default @@ -1333,7 +1333,7 @@ Default Description Format in which to download animated images. - Use ``true`` to download animated images as gifs and ``false`` + Use ``true`` to download animated images as gifs and ``false`` to download as mp4 videos. @@ -1641,7 +1641,7 @@ Description extractor.reactor.gif --------------------------- +--------------------- Type ``bool`` Default @@ -1649,7 +1649,7 @@ Default Description Format in which to download animated images. - Use ``true`` to download animated images as gifs and ``false`` + Use ``true`` to download animated images as gifs and ``false`` to download as mp4 videos. diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 230901e2..edf72d0f 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -799,6 +799,12 @@ Consider all sites to be NSFW unless otherwise known. Artists, Artist Listings, Artworks, individual Images + + Wikieat + https://wikieat.club/ + Boards, Threads + + xHamster https://xhamster.com/ diff --git a/gallery_dl/extractor/luscious.py b/gallery_dl/extractor/luscious.py index de90d956..c2961027 100644 --- a/gallery_dl/extractor/luscious.py +++ b/gallery_dl/extractor/luscious.py @@ -131,8 +131,10 @@ class LusciousAlbumExtractor(LusciousExtractor): image["date"] = text.parse_timestamp(image["created"]) image["id"] = text.parse_int(image["id"]) - url = image["url_to_original"] or image["url_to_video"] \ - if self.gif else image["url_to_video"] or image["url_to_original"] + url = (image["url_to_original"] or image["url_to_video"] + if self.gif else + image["url_to_video"] or image["url_to_original"]) + yield Message.Url, url, text.nameext_from_url(url, image) def metadata(self): diff --git a/gallery_dl/extractor/wikieat.py b/gallery_dl/extractor/wikieat.py index 66969819..f544bcb8 100644 --- a/gallery_dl/extractor/wikieat.py +++ b/gallery_dl/extractor/wikieat.py @@ -12,7 +12,7 @@ from .common import Extractor, Message from .. import text -class _WikieatThreadExtractor(Extractor): +class WikieatThreadExtractor(Extractor): """Extractor for Wikieat threads""" category = "wikieat" subcategory = "thread" @@ -20,16 +20,18 @@ class _WikieatThreadExtractor(Extractor): filename_fmt = "{time}{num:?-//} {filename}.{extension}" archive_fmt = "{board}_{thread}_{tim}" pattern = r"(?:https?://)?wikieat\.club/([^/]+)/res/(\d+)" - test = ( - ("https://wikieat.club/cel/res/25321.html") - ) + test = ("https://wikieat.club/cel/res/25321.html", { + "pattern": r"https://wikieat\.club/cel/src/\d+(-\d)?\.\w+", + "count": ">= 200", + }) def __init__(self, match): Extractor.__init__(self, match) self.board, self.thread = match.groups() def items(self): - url = "https://wikieat.club/{}/res/{}.json".format(self.board, self.thread) + url = "https://wikieat.club/{}/res/{}.json".format( + self.board, self.thread) posts = self.request(url).json()["posts"] title = posts[0].get("sub") or text.remove_html(posts[0]["com"]) process = self._process @@ -62,14 +64,15 @@ class _WikieatThreadExtractor(Extractor): return Message.Url, url, post -class _WikieatBoardExtractor(Extractor): +class WikieatBoardExtractor(Extractor): """Extractor for Wikieat boards""" category = "wikieat" subcategory = "board" - pattern = r"(?:https?://)?wikieat\.club/([^/?#]+)/(?:index|catalog|\d+)\.html" + pattern = (r"(?:https?://)?wikieat\.club" + r"/([^/?#]+)/(?:index|catalog|\d+)\.html") test = ( ("https://wikieat.club/cel/index.html", { - "pattern": _WikieatThreadExtractor.pattern, + "pattern": WikieatThreadExtractor.pattern, "count": ">= 100", }), ("https://wikieat.club/cel/catalog.html"), @@ -89,5 +92,5 @@ class _WikieatBoardExtractor(Extractor): url = "https://wikieat.club/{}/res/{}.html".format( self.board, thread["no"]) thread["page"] = page["page"] - thread["_extractor"] = _WikieatThreadExtractor + thread["_extractor"] = WikieatThreadExtractor yield Message.Queue, url, thread