From 6b6eb0b8f6cd31bf8b322144f1b272d63768b686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 10 May 2022 12:17:59 +0200 Subject: [PATCH] [lolisafe] implement 'domain' option (#2575) --- docs/configuration.rst | 29 +++++++++++++++++++++++++++++ docs/gallery-dl.conf | 4 ++++ gallery_dl/extractor/lolisafe.py | 6 ++++++ 3 files changed, 39 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 9dc9f170..453ee5ac 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -877,6 +877,21 @@ Description Download embedded videos hosted on https://www.blogger.com/ +extractor.cyberdrop.domain +-------------------------- +Type + ``string`` +Default + ``"auto"`` +Example + ``"cyberdrop.to"`` +Description + Specifies the domain used by ``cyberdrop`` regardless of input URL. + + Setting this option to ``"auto"`` + uses the same domain as a given input URL. + + extractor.danbooru.external --------------------------- Type @@ -1531,6 +1546,20 @@ Description the first in the list gets chosen (usually `mp3`). +extractor.lolisafe.domain +------------------------- +Type + ``string`` +Default + ``"auto"`` +Description + Specifies the domain used by a ``lolisafe`` extractor + regardless of input URL. + + Setting this option to ``"auto"`` + uses the same domain as a given input URL. + + extractor.luscious.gif ---------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index acb02626..58fdbdb4 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -50,6 +50,10 @@ { "videos": true }, + "cyberdrop": + { + "domain": "auto" + }, "danbooru": { "username": null, diff --git a/gallery_dl/extractor/lolisafe.py b/gallery_dl/extractor/lolisafe.py index ad7cd1d9..b6a508d9 100644 --- a/gallery_dl/extractor/lolisafe.py +++ b/gallery_dl/extractor/lolisafe.py @@ -63,6 +63,12 @@ class LolisafeAlbumExtractor(LolisafeExtractor): LolisafeExtractor.__init__(self, match) self.album_id = match.group(match.lastindex) + domain = self.config("domain") + if domain is None or domain == "auto": + self.root = text.root_from_url(match.group(0)) + else: + self.root = text.ensure_http_scheme(domain) + def items(self): files, data = self.fetch_album(self.album_id)