pull-flickr
v1.0.1
Published
Consume the flickr API (search at this stage) with pull-streams
Downloads
3
Readme
pull-flickr
Consume the flickr API (search at this stage) with pull-streams
Example Usage
Displayed below is a simple example that looks for "water buffalo" in the creative commons collection from flickr.
const pull = require('pull-stream');
const flickr = require('pull-flickr')({ api_key: 'ca43d47b18b91ff639c9628f9cf828cd' });
// search for water buffalo and output the results to the console
// NOTE: because this is using a pull.log (which uses a pull.drain) all
// the results will be displayed
pull(
flickr.search('water buffalo', { is_commons: true }),
pull.log()
);
To convert the item data into image urls, you can use a pull.map
through in combination with the flickr.url
function:
const pull = require('pull-stream');
const { search, url } = require('pull-flickr')({ api_key: 'ca43d47b18b91ff639c9628f9cf828cd' });
pull(
search('water buffalo', { is_commons: true }),
pull.map(result => url('small square', result)),
pull.log()
);
Specifying API Options
While I normally prefer options that use mixed case identifiers, this module uses the underscore separated identifiers that are documented in the Flickr Search API. This means that any of the options that are passed through as query string parameters can be used in this module.
License(s)
ISC
Copyright (c) 2017, Damon Oehlman [email protected]
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.