A simple search module using the flickr API
Simply include the flick-search module in your webpage:
<script src="flickr-search.js"></script>
Then create a Flickr instance:
var flickr = new Flickr({
api_key: 'your-api-key'
});
Search Flickr for matching photos.
flickr.search(parameters, callback);
- parameters - (object) An object with the list of parameters to send to the API;
- callback - (function) The function to execute when we got the result. Will get 2 parameters: err (object) and data (object);
flickr.search({
text: 'flower'
}, function(err, data) {
if (err) return console.error(err);
console.log(data);
});
For more informations on parameters see the Flickr API Documentation.
Search Flickr for interesting photos.
flickr.interesting(parameters, callback);
- parameters - (object) An object with the list of parameters to send to the API.
- callback - (function) The function to execute when we got the result. Will get 2 parameters: err (object) and data (object).
For more informations on parameters see the Flickr API Documentation.
flickr.interesting({}, function(err, data) {
if (err) return console.error(err);
console.log(data);
});
Make a raw request to the Flickr API
flickr.request(parameters, callback);
- parameters - (object) An object with the list of parameters to send to the API.
- callback - (function) The function to execute when we got the result. Will get 2 parameters: err (object) and data (object).
You MUST set the parameters.method property, for a full list of the available methods see the Flickr API Documentation.
flickr.request({
method: 'flickr.panda.getPhotos',
panda_name: 'wang wang'
}, function(err, data) {
if (err) return console.error(err);
console.log(data);
});