alexis-mignon / python-flickr-api

A python implementation of the Flickr API
BSD 3-Clause "New" or "Revised" License
367 stars 108 forks source link

save on a video kills the script #102

Closed sanderboer closed 5 years ago

sanderboer commented 5 years ago

Hi,

p.save("myvideo") works fine as long as p is a photo, when p.media =="video" this happens: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/xxxx/.local/lib/python2.7/site-packages/flickr_api/objects.py", line 1325, in save with open(filename + file_ext, 'wb') as f: IOError: [Errno 2] No such file or directory: u'test.com/photos/xxxxxxxxxxxxxxxxxxx'

Is there maybe a way to expose a naked http link for this item ?

gr. Sander

sanderboer commented 5 years ago

Right now I changed the permissions on all of my vids to open and use urllib:

urllib.urlretrieve ("https://www.flickr.com/video_download.gne?id="+p.id, fpath+".mp4")

Feels iffy to hardcode a flickr URL into the api, but this could be an approach.

mtrovo commented 5 years ago

The save function was trying to obtain the correct extension from the photo url itself, but for videos this URL doesn't have any extension (ends with /) and so the extracting was failing.

I fixed it by forcing the extension to ".mp4" when the photo.media is "video".

A new version v0.7.3 with this fix was released today if you want to test it.