From cb0132e4419b8ec9e97ee41335b3ee6e7e4507e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 12 Jul 2020 23:06:42 +0200 Subject: [PATCH] [khinsider] add 'format' option (closes #840) --- docs/configuration.rst | 15 +++++++++++++++ gallery_dl/extractor/khinsider.py | 21 ++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index e456c5c0..ce9e0747 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -879,6 +879,21 @@ Description Download video files. =========== ===== +extractor.khinsider.format +-------------------------- +=========== ===== +Type ``string`` +Default ``"mp3"`` +Description The name of the preferred file format to download. + + Use ``"all"`` to download all available formats, + or a (comma-separated) list to select multiple formats. + + If the selected format is not available, + the first in the list gets chosen (usually `mp3`). +=========== ===== + + extractor.kissmanga.captcha --------------------------- =========== ===== diff --git a/gallery_dl/extractor/khinsider.py b/gallery_dl/extractor/khinsider.py index 822a7431..2550af24 100644 --- a/gallery_dl/extractor/khinsider.py +++ b/gallery_dl/extractor/khinsider.py @@ -56,12 +56,27 @@ class KhinsiderSoundtrackExtractor(AsynchronousMixin, Extractor): }} def tracks(self, page): - page = text.extract(page, '', '
')[0] + fmt = self.config("format", ("mp3",)) + if fmt and isinstance(fmt, str): + if fmt == "all": + fmt = None + else: + fmt = fmt.lower().split(",") + page = text.extract(page, '', '
')[0] for num, url in enumerate(text.extract_iter( page, '