1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 11:41:35 +01:00

[wallpapercave] support 'album' listings (#5925)

This commit is contained in:
Mike Fährmann 2024-08-02 15:39:11 +02:00
parent a5be680596
commit f68b0efc1b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 25 additions and 1 deletions

View File

@ -18,7 +18,7 @@ class WallpapercaveImageExtractor(Extractor):
category = "wallpapercave"
subcategory = "image"
root = "https://wallpapercave.com"
pattern = r"(?:https?://)?(?:www\.)?wallpapercave\.com"
pattern = r"(?:https?://)?(?:www\.)?wallpapercave\.com/"
example = "https://wallpapercave.com/w/wp12345"
def items(self):
@ -40,3 +40,12 @@ class WallpapercaveImageExtractor(Extractor):
image = text.nameext_from_url(path)
yield Message.Directory, image
yield Message.Url, self.root + path, image
if path is None:
for wp in text.extract_iter(
page, 'class="wallpaper" id="wp', '</picture>'):
path = text.rextract(wp, ' src="', '"')[0]
if path:
image = text.nameext_from_url(path)
yield Message.Directory, image
yield Message.Url, self.root + path, image

View File

@ -12,7 +12,22 @@ __tests__ = (
"#url" : "https://wallpapercave.com/w/wp10270355",
"#category": ("", "wallpapercave", "image"),
"#class" : wallpapercave.WallpapercaveImageExtractor,
"#urls" : "https://wallpapercave.com/download/sekai-saikou-no-ansatsusha-isekai-kizoku-ni-tensei-suru-wallpapers-wp10270355",
"#sha1_content": "58b088aaa1cf1a60e347015019eb0c5a22b263a6",
},
{
"#url" : "https://wallpapercave.com/apple-wwdc-2024-wallpapers",
"#comment" : "album listing",
"#category": ("", "wallpapercave", "image"),
"#class" : wallpapercave.WallpapercaveImageExtractor,
"#archive" : False,
"#urls" : [
"https://wallpapercave.com/wp/wp13775438.jpg",
"https://wallpapercave.com/wp/wp13775439.jpg",
"https://wallpapercave.com/wp/wp13775440.jpg",
"https://wallpapercave.com/wp/wp13775441.jpg",
],
},
)