[unsplash] add 'format' option (#1197)

This commit is contained in:
Mike Fährmann
2021-01-21 22:41:49 +01:00
parent 3188ac16d1
commit 7a096c443f
2 changed files with 15 additions and 1 deletions

View File

@@ -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"