From 7a096c443fd950129c6487beffc55061ada7b9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 21 Jan 2021 22:41:49 +0100 Subject: [PATCH] [unsplash] add 'format' option (#1197) --- docs/configuration.rst | 13 +++++++++++++ gallery_dl/extractor/unsplash.py | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 96329f0d..538e6ca4 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1600,6 +1600,19 @@ Description * ``false``: Skip video Tweets +extractor.unsplash.format +------------------------- +Type + ``string`` +Default + ``"raw"`` +Description + Name of the image format to download. + + Available formats are + ``"raw"``, ``"full"``, ``"regular"``, ``"small"``, and ``"thumb"``. + + extractor.vsco.videos --------------------- Type diff --git a/gallery_dl/extractor/unsplash.py b/gallery_dl/extractor/unsplash.py index 6013410b..bf6d2541 100644 --- a/gallery_dl/extractor/unsplash.py +++ b/gallery_dl/extractor/unsplash.py @@ -27,10 +27,11 @@ class UnsplashExtractor(Extractor): self.item = match.group(1) def items(self): + fmt = self.config("format") or "raw" for photo in self.photos(): util.delete_items( photo, ("current_user_collections", "related_collections")) - url = photo["urls"]["raw"] + url = photo["urls"][fmt] text.nameext_from_url(url, photo) photo["extension"] = "jpg"