Skip to content

Commit

Permalink
[flickr] skip unavailable images/videos (fixes #398)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Aug 27, 2019
1 parent c9b97db commit 20fd2d8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gallery_dl/extractor/flickr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 20fd2d8

Please sign in to comment.