You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I just wanted to say thanks for this library. I'm using it to download all my photos from flickr so I can import them in to Photos.app. The README got me up and running quickly, and everything seems to be working great! I got a little tripped up with flickr's API, but once I read their docs everything went smoothly.
Here's the program I wrote (it streams photos from flickr in parallel):
require'flickraw'require'net/http'require'net/https'require'uri'queue=Queue.newSIZE=5downloaders=SIZE.times.mapdoThread.newdoThread.current.abort_on_exception=truehttp=Net::HTTP.new'farm1.staticflickr.com',443http.use_ssl=truehttp.startwhilework=queue.popurl=URI(work)filename=url.path[/[^\/]*$/]pfilenamereq=Net::HTTP::Get.new(url.request_uri)http.request(req)do |res|
File.open"pics/#{filename}","wb"do |f|
res.read_bodydo |segment|
f.writesegmentendendendendendendFlickRaw.api_key=ENV["FLICKR_API_KEY"]FlickRaw.shared_secret=ENV["FLICKR_SHARED_SECRET"]flickr=FlickRaw::Flickr.newflickr.access_token=ENV["FLICKR_ACCESS_TOKEN"]flickr.access_secret=ENV["FLICKR_ACCESS_SECRET"]# From here you are logged:login=flickr.test.loginputs"You are now authenticated as #{login.username}"per_page=500total_photos=flickr.people.getInfo(user_id: login.id).photos.countpages=total_photos / per_page + (total_photos % per_page == 0 ? 0 : 1)ppageslogin_id=login.idpages.times.mapdo |page|
Thread.newdopPAGE: pageflickr.people.getPhotos(user_id: login_id,per_page: per_page,page: page + 1).eachdo |thing|
original=flickr.photos.getSizes(photo_id: thing.id).find{ |size|
size.label == "Original"}queue << original.sourceendendend.map(&:join)SIZE.times{queue << nil}puts"DONE"downloaders.map(&:join)
Anyway, just wanted to say thanks!
The text was updated successfully, but these errors were encountered:
Hi, I just wanted to say thanks for this library. I'm using it to download all my photos from flickr so I can import them in to Photos.app. The README got me up and running quickly, and everything seems to be working great! I got a little tripped up with flickr's API, but once I read their docs everything went smoothly.
Here's the program I wrote (it streams photos from flickr in parallel):
Anyway, just wanted to say thanks!
The text was updated successfully, but these errors were encountered: