random-flickr
v0.2.5
Published
fetch random images from the Flickr API
Downloads
13
Readme
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.randomSearch(['ballon', 'panzer'], 10000 )
.then( console.log )
// {
// "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.fetchOne = function( path, photo )
.then( console.log ) // path
don't overdo parallel downloadn the socket will hangup.