1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00

[urlgalleries] add support

This commit is contained in:
jsouthgb 2023-12-05 07:07:06 -05:00
parent 4dde36889c
commit 1770c31e63
3 changed files with 50 additions and 0 deletions

View File

@ -889,6 +889,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Files</td> <td>Files</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>Urlgalleries</td>
<td>https://urlgalleries.net/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr> <tr>
<td>Vipergirls</td> <td>Vipergirls</td>
<td>https://vipergirls.to/</td> <td>https://vipergirls.to/</td>

View File

@ -155,6 +155,7 @@ modules = [
"tumblrgallery", "tumblrgallery",
"twibooru", "twibooru",
"twitter", "twitter",
"urlgalleries",
"unsplash", "unsplash",
"uploadir", "uploadir",
"urlshortener", "urlshortener",

View File

@ -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"', "</div>")
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;'> ", '</div>').split(" | ")[-1]
return {
'title': self.title,
'date': text.parse_datetime(date, format='%B %d, %Y T%H:%M')
}