diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index df252ee3..eb5c6418 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -45,7 +45,7 @@ class FlickrExtractor(Extractor): self.log.debug("", exc_info=exc) else: photo.update(data) - url = photo["url"] + url = self._file_url(photo) yield Message.Directory, photo yield Message.Url, url, text.nameext_from_url(url, photo) @@ -57,6 +57,13 @@ class FlickrExtractor(Extractor): def photos(self): """Return an iterable with all relevant photo objects""" + def _file_url(self, photo): + if "video" in photo: + return photo["url"] + + path, _, ext = photo["url"].rpartition(".") + return path + "_d." + ext + class FlickrImageExtractor(FlickrExtractor): """Extractor for individual images from flickr.com""" @@ -98,7 +105,7 @@ class FlickrImageExtractor(FlickrExtractor): if isinstance(value, dict): location[key] = value["_content"] - url = photo["url"] + url = self._file_url(photo) yield Message.Directory, photo yield Message.Url, url, text.nameext_from_url(url, photo) diff --git a/test/results/flickr.py b/test/results/flickr.py index e5bc69c9..5ae58050 100644 --- a/test/results/flickr.py +++ b/test/results/flickr.py @@ -17,6 +17,7 @@ __tests__ = ( "contexts": True, "exif": True, }, + "#urls" : "https://live.staticflickr.com/7463/16089302239_de18cd8017_b_d.jpg", "#pattern" : flickr.FlickrImageExtractor.pattern, "#sha1_content": [ "3133006c6d657fe54cf7d4c46b82abbcb0efaf9f", @@ -28,7 +29,7 @@ __tests__ = ( "description": str, "exif" : list, "extension" : "jpg", - "filename" : "16089302239_de18cd8017_b", + "filename" : "16089302239_de18cd8017_b_d", "id" : 16089302239, "height" : 683, "label" : "Large", @@ -59,10 +60,10 @@ __tests__ = ( }, { - "#url" : "https://www.flickr.com/photos/145617051@N08/46733161535", - "#category": ("", "flickr", "image"), + "#url" : "https://www.flickr.com/photos/eliasroviello/52713899383/", + "#comment" : "video", "#class" : flickr.FlickrImageExtractor, - "#count" : 1, + "#pattern" : r"https://live.staticflickr\.com/video/52713899383/51dfffef79/1080p\.mp4\?s=ey.+", "media": "video", },