mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-21 18:22:30 +01:00
[flickr] use "download" URLs (#6360)
This commit is contained in:
parent
1ddbcda58b
commit
0e18fa395d
@ -45,7 +45,7 @@ class FlickrExtractor(Extractor):
|
|||||||
self.log.debug("", exc_info=exc)
|
self.log.debug("", exc_info=exc)
|
||||||
else:
|
else:
|
||||||
photo.update(data)
|
photo.update(data)
|
||||||
url = photo["url"]
|
url = self._file_url(photo)
|
||||||
yield Message.Directory, photo
|
yield Message.Directory, photo
|
||||||
yield Message.Url, url, text.nameext_from_url(url, photo)
|
yield Message.Url, url, text.nameext_from_url(url, photo)
|
||||||
|
|
||||||
@ -57,6 +57,13 @@ class FlickrExtractor(Extractor):
|
|||||||
def photos(self):
|
def photos(self):
|
||||||
"""Return an iterable with all relevant photo objects"""
|
"""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):
|
class FlickrImageExtractor(FlickrExtractor):
|
||||||
"""Extractor for individual images from flickr.com"""
|
"""Extractor for individual images from flickr.com"""
|
||||||
@ -98,7 +105,7 @@ class FlickrImageExtractor(FlickrExtractor):
|
|||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
location[key] = value["_content"]
|
location[key] = value["_content"]
|
||||||
|
|
||||||
url = photo["url"]
|
url = self._file_url(photo)
|
||||||
yield Message.Directory, photo
|
yield Message.Directory, photo
|
||||||
yield Message.Url, url, text.nameext_from_url(url, photo)
|
yield Message.Url, url, text.nameext_from_url(url, photo)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ __tests__ = (
|
|||||||
"contexts": True,
|
"contexts": True,
|
||||||
"exif": True,
|
"exif": True,
|
||||||
},
|
},
|
||||||
|
"#urls" : "https://live.staticflickr.com/7463/16089302239_de18cd8017_b_d.jpg",
|
||||||
"#pattern" : flickr.FlickrImageExtractor.pattern,
|
"#pattern" : flickr.FlickrImageExtractor.pattern,
|
||||||
"#sha1_content": [
|
"#sha1_content": [
|
||||||
"3133006c6d657fe54cf7d4c46b82abbcb0efaf9f",
|
"3133006c6d657fe54cf7d4c46b82abbcb0efaf9f",
|
||||||
@ -28,7 +29,7 @@ __tests__ = (
|
|||||||
"description": str,
|
"description": str,
|
||||||
"exif" : list,
|
"exif" : list,
|
||||||
"extension" : "jpg",
|
"extension" : "jpg",
|
||||||
"filename" : "16089302239_de18cd8017_b",
|
"filename" : "16089302239_de18cd8017_b_d",
|
||||||
"id" : 16089302239,
|
"id" : 16089302239,
|
||||||
"height" : 683,
|
"height" : 683,
|
||||||
"label" : "Large",
|
"label" : "Large",
|
||||||
@ -59,10 +60,10 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.flickr.com/photos/145617051@N08/46733161535",
|
"#url" : "https://www.flickr.com/photos/eliasroviello/52713899383/",
|
||||||
"#category": ("", "flickr", "image"),
|
"#comment" : "video",
|
||||||
"#class" : flickr.FlickrImageExtractor,
|
"#class" : flickr.FlickrImageExtractor,
|
||||||
"#count" : 1,
|
"#pattern" : r"https://live.staticflickr\.com/video/52713899383/51dfffef79/1080p\.mp4\?s=ey.+",
|
||||||
|
|
||||||
"media": "video",
|
"media": "video",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user