From 512abeb4aeae51c7e5b3c0e92be58710c61417c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 13 Jan 2023 16:32:32 +0100 Subject: [PATCH] [booru] add 'url' option --- docs/configuration.rst | 12 ++++++++++++ gallery_dl/extractor/booru.py | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 73570e3f..422cdee3 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3245,6 +3245,18 @@ Description Note: This requires 1 additional HTTP request per post. +extractor.[booru].url +--------------------- +Type + ``string`` +Default + ``"file_url"`` +Example + ``"preview_url"`` +Description + Alternate field name to retrieve download URLs from. + + extractor.[manga-extractor].chapter-reverse ------------------------------------------- Type diff --git a/gallery_dl/extractor/booru.py b/gallery_dl/extractor/booru.py index 0d7d13d4..cbd0e07f 100644 --- a/gallery_dl/extractor/booru.py +++ b/gallery_dl/extractor/booru.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2022 Mike Fährmann +# Copyright 2015-2023 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 @@ -27,6 +27,10 @@ class BooruExtractor(BaseExtractor): notes = self.config("notes", False) fetch_html = tags or notes + url_key = self.config("url") + if url_key: + self._file_url = operator.itemgetter(url_key) + for post in self.posts(): try: url = self._file_url(post)