summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/comedywildlifephoto.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
commita24ec1647aeac35a63b744ea856011ad6e06be3b (patch)
treeae94416de786aeddd05d99559098f7f16bb103a6 /gallery_dl/extractor/comedywildlifephoto.py
parent33f8a8a37a9cba738ef25fb99955f0730da9eb48 (diff)
New upstream version 1.31.1.upstream/1.31.1
Diffstat (limited to 'gallery_dl/extractor/comedywildlifephoto.py')
-rw-r--r--gallery_dl/extractor/comedywildlifephoto.py51
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