1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[flickr] use "download" URLs (#6360)

This commit is contained in:
Mike Fährmann 2024-11-09 17:33:27 +01:00
parent 1ddbcda58b
commit 0e18fa395d
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 14 additions and 6 deletions

View File

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

View File

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