diff options
| author | 2025-12-20 05:49:11 -0500 | |
|---|---|---|
| committer | 2025-12-20 05:49:11 -0500 | |
| commit | c586ea4b3c871f5696626f9820e8c88a4e78f4a6 (patch) | |
| tree | e6d7bae96282c3d147159f091d451e53bdaa2efe /gallery_dl/extractor/comedywildlifephoto.py | |
| parent | 01a2bf622c31072d1322884584404b9bd59b28cc (diff) | |
| parent | a24ec1647aeac35a63b744ea856011ad6e06be3b (diff) | |
Update upstream source from tag 'upstream/1.31.1'
Update to upstream version '1.31.1'
with Debian dir b5d91c25143175f933b1c69c7e82249cd7e145ab
Diffstat (limited to 'gallery_dl/extractor/comedywildlifephoto.py')
| -rw-r--r-- | gallery_dl/extractor/comedywildlifephoto.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gallery_dl/extractor/comedywildlifephoto.py b/gallery_dl/extractor/comedywildlifephoto.py new file mode 100644 index 0000000..a1c1ef4 --- /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("<h1>", "<").strip(), + "title" : extr(">", "<"), + "description": text.unescape(extr( + 'class="c1 np">', "<div")), + } + + def images(self, page): + results = [] + + for fig in text.extract_iter(page, "<figure", "</figure>"): + 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, "<figcaption>", "<")), + } + )) + + return results |
