Path: blob/master/gallery_dl/extractor/comedywildlifephoto.py
8950 views
# -*- coding: utf-8 -*-12# Copyright 2025 Mike Fährmann3#4# This program is free software; you can redistribute it and/or modify5# it under the terms of the GNU General Public License version 2 as6# published by the Free Software Foundation.78"""Extractors for https://www.comedywildlifephoto.com/"""910from .common import GalleryExtractor11from .. import text121314class ComedywildlifephotoGalleryExtractor(GalleryExtractor):15"""Extractor for comedywildlifephoto galleries"""16category = "comedywildlifephoto"17root = "https://www.comedywildlifephoto.com"18directory_fmt = ("{category}", "{section}", "{title}")19filename_fmt = "{num:>03} {filename}.{extension}"20archive_fmt = "{section}/{title}/{num}"21pattern = (r"(?:https?://)?(?:www\.)?comedywildlifephoto\.com"22r"(/gallery/[^/?#]+/[^/?#]+\.php)")23example = "https://www.comedywildlifephoto.com/gallery/SECTION/TITLE.php"2425def metadata(self, page):26extr = text.extract_from(page)2728return {29"section": extr("<h1>", "<").strip(),30"title" : extr(">", "<"),31"description": text.unescape(extr(32'class="c1 np">', "<div")),33}3435def images(self, page):36results = []3738for fig in text.extract_iter(page, "<figure", "</figure>"):39width, _, height = text.extr(40fig, 'data-size="', '"').partition("x")41results.append((42self.root + text.extr(fig, 'href="', '"'), {43"width" : text.parse_int(width),44"height" : text.parse_int(height),45"caption": text.unescape(text.extr(46fig, "<figcaption>", "<")),47}48))4950return results515253