From b17e2dcf939e82bb375db0e581daeaf2d3a42b53 Mon Sep 17 00:00:00 2001 From: David Hoppenbrouwers Date: Fri, 11 Feb 2022 23:44:51 +0100 Subject: [PATCH] [wallpapercave] add extractor for images (#2205) --- docs/supportedsites.md | 6 ++++++ gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/wallpapercave.py | 30 +++++++++++++++++++++++++++ scripts/supportedsites.py | 4 ++++ 4 files changed, 41 insertions(+) create mode 100644 gallery_dl/extractor/wallpapercave.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 1ca068c6..fea984af 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -787,6 +787,12 @@ Consider all sites to be NSFW unless otherwise known. Collections, individual Images, Search Results API Key + + Wallpaper Cave + https://wallpapercave.com/ + individual Images, Search Results + + Warosu https://warosu.org/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 73bd6f28..b52561e9 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -132,6 +132,7 @@ modules = [ "vk", "vsco", "wallhaven", + "wallpapercave", "warosu", "weasyl", "webtoons", diff --git a/gallery_dl/extractor/wallpapercave.py b/gallery_dl/extractor/wallpapercave.py new file mode 100644 index 00000000..6c3af767 --- /dev/null +++ b/gallery_dl/extractor/wallpapercave.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +# Copyright 2021 David Hoppenbrouwers +# +# 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. + +"""Extractors for https://wallpapercave.com/""" + +from .common import Extractor, Message +from .. import text + + +class WallpapercaveImageExtractor(Extractor): + """Extractor for images on wallpapercave.com""" + category = "wallpapercave" + subcategory = "image" + root = "https://wallpapercave.com" + pattern = r"(?:https?://)?(?:www\.)?wallpapercave\.com" + test = ("https://wallpapercave.com/w/wp10270355", { + "content": "58b088aaa1cf1a60e347015019eb0c5a22b263a6", + }) + + def items(self): + page = self.request(text.ensure_http_scheme(self.url)).text + for path in text.extract_iter(page, 'class="download" href="', '"'): + image = text.nameext_from_url(path) + yield Message.Directory, image + yield Message.Url, self.root + path, image diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 62db3e98..6bf9a1d8 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -111,6 +111,7 @@ CATEGORY_MAP = { "vk" : "VK", "vsco" : "VSCO", "wakarimasen" : "Wakarimasen Archive", + "wallpapercave" : "Wallpaper Cave", "webtoons" : "Webtoon", "wikiart" : "WikiArt.org", "xhamster" : "xHamster", @@ -203,6 +204,9 @@ SUBCATEGORY_MAP = { "wallhaven": { "collections": "", }, + "wallpapercave": { + "image": "individual Images, Search Results", + }, "weasyl": { "journals" : "", "submissions": "",