random-flickr
Simple node package wich come on top of the Flickr Javascript SDK
My aim was to add some functions and simple alias.
Install
npm install random-flickr
Test
need node6++
KEY="" SECRET="" npm run test
First
You should take a look at the Flickr Javascript SDK documentation
Every methods of the Flickr Javascript SDK are available.
randomSearch
/** * @desc Search a set number of images for each keyword. * There should'nt have doubles. * @param { String | Array } keywords, * tag that the images must match. * @param { Number } quantity, * the number of returned images for each Keyword. * [@param { Number } minPickPerPage, * minimal random image picked per page, higher min less request.] * @return { Array } images, image object found. */ flickr // { // "ballon": { "totalFlickr": 1312413, "photos": [ ... ]} // "panzer": { "totalFlickr": 38123, "photos": [ ... ]} // }
you can build the image's navigator urls with the owner and id properties as :
https://flickr.com/photos/${owner}/${id}
fetchOne
/** * @desc download a photo from the flickr api (use 2 requests) * @param { String } path, destination filename and path. * @param { Object } photo, flickr photo object. * [@param { Number } maxWidth, maximum size of the downloaded photo.] * return { String } path. */ flickr .then( console.log ) // path
don't overdo parallel downloadn the socket will hangup.