From 20fd2d845003e6a5e6d1e008a2ac43be0220ad57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 27 Aug 2019 23:26:49 +0200 Subject: [PATCH] [flickr] skip unavailable images/videos (fixes #398) --- gallery_dl/extractor/flickr.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index d941d76644..73b8ec4cc9 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -25,12 +25,20 @@ def __init__(self, match): def items(self): data = self.metadata() + extract = self.api._extract_format yield Message.Version, 1 yield Message.Directory, data for photo in self.photos(): - photo.update(data) - url = photo["url"] - yield Message.Url, url, text.nameext_from_url(url, photo) + try: + photo = extract(photo) + except Exception as exc: + self.log.warning( + "Skipping %s (%s)", photo["id"], exc.__class__.__name__) + self.log.debug("", exc_info=True) + else: + photo.update(data) + url = photo["url"] + yield Message.Url, url, text.nameext_from_url(url, photo) def metadata(self): """Return general metadata""" @@ -432,7 +440,7 @@ def _pagination(self, method, params, key="photos"): while True: data = self._call(method, params)[key] - yield from map(self._extract_format, data["photo"]) + yield from data["photo"] if params["page"] >= data["pages"]: return params["page"] += 1