Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
flickr-sdk
Advanced tools
The easiest way to talk to the Flickr API with node.js or a web browser. Officially supported by the Flickr Front End team.
Currently we cover the 10 most popular API methods (and some others) but we'll be adding support for more all the time.
npm install flickr-sdk
You'll need to create an API key for your app, get a user to grant your app access to their data. Implementing that process and storing a user's oauth token and secret is your job. Here's a tool that walks you through that process quickly so you can start testing.
var Flickr = require('flickr-sdk');
var flickr = new Flickr({
"apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"apiSecret": "xxxxxxxxxxxxxxxx",
"accessToken": "xxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx",
"accessTokenSecret": "xxxxxxxxxxxxxxxx"
});
All responses are objects with two properties:
body
- containing the data requestedheaders
- any meta data returned in the headers from the APIflickr
.request()
.media()
.post({
'photo': './path/to/photo.jpg'
})
.then(function (response) {
// Photo object with links to resources
});
On the server the photo parameter should be a path to a local file. On the client it'll accept a File
object from a browser file field.
flickr
.request()
.media('22397283330')
.get()
.then(function (response) {
// Photo object with links to resources
});
flickr
.request()
.media()
.search("puppies")
.get()
.then(function (response) {
// An array of media objects matching the search term
});
flickr
.request()
.people("40575690@N00") // ID or path alias
.media()
.get()
.then(function (response) {
// An array of media objects belonging to the person
});
flickr
.request()
.people("40575690@N00") // ID or path alias
.favorites()
.media()
.get()
.then(function (response) {
// An array of media objects this person has faved
});
flickr
.request()
.people("40575690@N00") // ID or path alias
.albums()
.get()
.then(function (response) {
// An array of album objects belonging to this person
});
flickrSDK
.request()
.media('22397283330') // Photo ID to fetch context for
.context(5) // Number of photos to get either side of this one
.album('72157657634723246') // An album ID
.get()
.then(function (response) {
// Two arrays of photo objects, one for previous, one for next
});
Other contexts available:
flickr.request().media(*photoID*).context(5).photolist(*photolistHash*)
flickr.request().media(*photoID*).context(5).photosOf(*personID*)
flickr.request().media(*photoID*).context(5).groupPool(*groupID*)
flickr.request().media(*photoID*).context(5).sharedEntity(*guestpassID*, *guestpassOwner*)
flickr.request().media(*photoID*).context(5).gallery(*galleryID*)
flickr.request().media(*photoID*).context(5).photostream()
flickr.request().media(*photoID*).context(5).favorites(*personID*)
flickr
.request()
.groups('22397283330') // Group ID
.get()
.then(function (response) {
// Info about a group
});
flickr
.request()
.groups('22397283330')
.media()
.get()
.then(function (response) {
// A bunch of photos in a group
});
flickr
.request()
.groups('22397283330')
.discussions()
.get()
.then(function (response) {
// Discussions happening in this group
});
flickr
.request()
.albums('22397283330') // Album ID
.media()
.get()
.then(function (response) {
// Photos in an album
});
flickr
.request()
.galleries('22397283330') // Gallery ID
.media()
.get()
.then(function (response) {
// Photos in a gallery
});
Most methods accept a number of parameters to modify the response. Page and per page parameters are a common example. You can pass arbitrary as an object argument into the verb method like this:
flickr
.request()
.people("40575690@N00")
.media()
.get({
page: 2,
per_page: 20
})
.then(function (response) {
// Media items from 21-40
});
Here's a more advanced search example:
flickr
.request()
.media()
.search("puppies")
.get({
contacts: 'all', // Only media from the calling user's contacts
media: 'photos' // Only photos, no videos
sort: 'date-taken-desc' // Ordered by most recently taken photos
})
.then(function (response) {
// An array of media objects matching the search query including extra params
});
All API calls return a Promise. To handle an error just a provide a handler like this:
flickr
.request()
.people("🦄") // not a person ID at all
.media()
.get()
.then(function (response) {
// Success, we'll never get here
}, function (err) {
// Handle the error
});
Code licensed under the MIT license. See LICENSE file for terms.
FAQs
Almost certainly the best Flickr API client in the world for node and the browser
The npm package flickr-sdk receives a total of 1,130 weekly downloads. As such, flickr-sdk popularity was classified as popular.
We found that flickr-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.