diff --git a/docs/supportedsites.md b/docs/supportedsites.md index ef5f8ccb..4a50637a 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -205,6 +205,12 @@ Consider all listed sites to potentially be NSFW. Collections, Generated Files, individual Images, Image Listings, Models, Model Listings, Posts, Post Listings, Image Searches, Model Searches, Tag Searches, User Profiles, User Collections, User Images, Image Reactions, User Models, User Posts, User Videos, Video Reactions, Video Listings + + Comedy Wildlife Photography Awards + https://www.comedywildlifephoto.com/ + Galleries + + Comic Vine https://comicvine.gamespot.com/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 7661a9aa..77efc9be 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -45,6 +45,7 @@ modules = [ "chevereto", "cien", "civitai", + "comedywildlifephoto", "comick", "comicvine", "cyberdrop", diff --git a/gallery_dl/extractor/comedywildlifephoto.py b/gallery_dl/extractor/comedywildlifephoto.py new file mode 100644 index 00000000..a1c1ef45 --- /dev/null +++ b/gallery_dl/extractor/comedywildlifephoto.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +# Copyright 2025 Mike Fährmann +# +# 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://www.comedywildlifephoto.com/""" + +from .common import GalleryExtractor +from .. import text + + +class ComedywildlifephotoGalleryExtractor(GalleryExtractor): + """Extractor for comedywildlifephoto galleries""" + category = "comedywildlifephoto" + root = "https://www.comedywildlifephoto.com" + directory_fmt = ("{category}", "{section}", "{title}") + filename_fmt = "{num:>03} {filename}.{extension}" + archive_fmt = "{section}/{title}/{num}" + pattern = (r"(?:https?://)?(?:www\.)?comedywildlifephoto\.com" + r"(/gallery/[^/?#]+/[^/?#]+\.php)") + example = "https://www.comedywildlifephoto.com/gallery/SECTION/TITLE.php" + + def metadata(self, page): + extr = text.extract_from(page) + + return { + "section": extr("

", "<").strip(), + "title" : extr(">", "<"), + "description": text.unescape(extr( + 'class="c1 np">', ""): + width, _, height = text.extr( + fig, 'data-size="', '"').partition("x") + results.append(( + self.root + text.extr(fig, 'href="', '"'), { + "width" : text.parse_int(width), + "height" : text.parse_int(height), + "caption": text.unescape(text.extr( + fig, "
", "<")), + } + )) + + return results diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index da195c5a..e1db6fc6 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -43,6 +43,7 @@ CATEGORY_MAP = { "cfake" : "Celebrity Fakes", "cien" : "Ci-en", "cohost" : "cohost!", + "comedywildlifephoto": "Comedy Wildlife Photography Awards", "comicvine" : "Comic Vine", "cyberfile" : "CyberFile", "dankefuerslesen": "Danke fürs Lesen", diff --git a/test/results/comedywildlifephoto.py b/test/results/comedywildlifephoto.py new file mode 100644 index 00000000..93888aad --- /dev/null +++ b/test/results/comedywildlifephoto.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +# 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. + +from gallery_dl.extractor import comedywildlifephoto + + +__tests__ = ( +{ + "#url" : "https://www.comedywildlifephoto.com/gallery/finalists/2024_finalists.php", + "#class" : comedywildlifephoto.ComedywildlifephotoGalleryExtractor, + "#pattern" : r"https://www\.comedywildlifephoto\.com/images/gallery/\d/000017\d\d_p\.webp", + "#count" : 44, + + "count" : 44, + "num" : range(1, 44), + "description": "

Here are the finalists from the 2024 Comedy Wildlife Photography Awards competition. Winners will be announced on the 10th of December 2024. Voting for the People's Choice Award runs from 26th September until 31st October.

", + "caption" : str, + "filename" : str, + "extension" : "webp", + "width" : range(750, 1600), + "height" : range(750, 1600), + "section" : "Gallery of Winners and Finalists", + "title" : "2024 Finalists", +}, + +{ + "#url" : "https://www.comedywildlifephoto.com/gallery/finalists/2022_finalists.php", + "#comment" : "empty 'description'", + "#class" : comedywildlifephoto.ComedywildlifephotoGalleryExtractor, + "#range" : "4", + "#results" : "https://www.comedywildlifephoto.com/images/gallery/9/00001169_p.jpg", + + "count" : 43, + "num" : 4, + "description": "", + "caption" : "", + "filename" : "00001169_p", + "extension" : "jpg", + "width" : 1600, + "height" : 900, + "section" : "Gallery of Winners and Finalists", + "title" : "2022 Finalists", +}, + +)