From 1770c31e633d24bb4a6da23f599d900f70d77f80 Mon Sep 17 00:00:00 2001 From: jsouthgb Date: Tue, 5 Dec 2023 07:07:06 -0500 Subject: [PATCH 1/2] [urlgalleries] add support --- docs/supportedsites.md | 6 ++++ gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/urlgalleries.py | 43 ++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 gallery_dl/extractor/urlgalleries.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 8f54b15765..003dcaa979 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -889,6 +889,12 @@ Consider all sites to be NSFW unless otherwise known. Files + + Urlgalleries + https://urlgalleries.net/ + Galleries + + Vipergirls https://vipergirls.to/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 72239d5cbe..d074de22eb 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -155,6 +155,7 @@ "tumblrgallery", "twibooru", "twitter", + "urlgalleries", "unsplash", "uploadir", "urlshortener", diff --git a/gallery_dl/extractor/urlgalleries.py b/gallery_dl/extractor/urlgalleries.py new file mode 100644 index 0000000000..ae2b720533 --- /dev/null +++ b/gallery_dl/extractor/urlgalleries.py @@ -0,0 +1,43 @@ +# -*- 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. + +"""Extractors for https://urlgalleries.net/""" + +from .common import GalleryExtractor +from .. import text + + +class UrlgalleriesExtractor(GalleryExtractor): + """Base class for Urlgalleries extractors""" + category = "urlgalleries" + root = "urlgalleries.net" + directory_fmt = ("{category}", "{title}") + pattern = r"(?:https?://)([^/?#]+)?\.urlgalleries\.net/([^/?#]+)/([^/?#]+)" + example = "https://blog.urlgalleries.net/gallery-1234567/a-title--1234" + + def __init__(self, match): + self.blog = match.group(1) + self.gallery_id = match.group(2) + self.title = match.group(3) + url = "{}.urlgalleries.net/{}/{}&a=10000".format( + self.blog, self.gallery_id, self.title) + GalleryExtractor.__init__(self, match, text.ensure_http_scheme(url)) + + def images(self, page): + extr = text.extr(page, 'id="wtf"', "") + url = "{}{{}}".format(self.root).format + return [ + (text.ensure_http_scheme(url(i)), None) + for i in text.extract_iter(extr, "href='", "'") + ] + + def metadata(self, page): + date = text.extr( + page, "float:left;'> ", '').split(" | ")[-1] + return { + 'title': self.title, + 'date': text.parse_datetime(date, format='%B %d, %Y T%H:%M') + } From ecaa0feb5d9fc39d4b26aefa211d250e817f90fd Mon Sep 17 00:00:00 2001 From: jsouthgb Date: Tue, 5 Dec 2023 07:08:11 -0500 Subject: [PATCH 2/2] [urlgalleries] add support --- gallery_dl/extractor/urlgalleries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gallery_dl/extractor/urlgalleries.py b/gallery_dl/extractor/urlgalleries.py index ae2b720533..aa6e7db51b 100644 --- a/gallery_dl/extractor/urlgalleries.py +++ b/gallery_dl/extractor/urlgalleries.py @@ -10,7 +10,7 @@ from .. import text -class UrlgalleriesExtractor(GalleryExtractor): +class UrlgalleriesGalleryExtractor(GalleryExtractor): """Base class for Urlgalleries extractors""" category = "urlgalleries" root = "urlgalleries.net"