Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
spotify-url-info
Advanced tools
Get metadata from Spotify URLs.
npm install spotify-url-info
In order to use the library, you have to provide the fetch agent to use:
const fetch = require('isomorphic-unfetch')
const { getData, getPreview, getTracks, getDetails } =
require('spotify-url-info')(fetch)
There are four functions:
getData
Provides the full available data, in a shape that is very similar to what the spotify API returns.
getPreview
Always returns the same fields for different types of resources (album, artist, playlist, track). The preview track is the first in the Album, Playlist, etc.
getTracks
Returns array with tracks. This data is passed on straight from spotify, so the shape could change.Only the first 100 tracks will be returned.
getDetails
Returns both the preview and tracks. Should be used if you require information from both of them so that only one request is made.
All the methods receive a Spotify URL (play. or open.) as first argument:
getPreview('https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas').then(data =>
console.log(data)
)
Additionally, you can provide fetch agent options as second argument:
getPreview('https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas', {
headers: {
'user-agent': 'googlebot'
}
}).then(data => console.log(data))
It returns back the information related to the Spotify URL:
{
"title": "Immaterial",
"type": "track",
"track": "Immaterial",
"artist": "SOPHIE",
"image": "https://i.scdn.co/image/d6f496a6708d22a2f867e5acb84afb0eb0b07bc1",
"audio": "https://p.scdn.co/mp3-preview/6be8eb12ff18ae09b7a6d38ff1e5327fd128a74e?cid=162b7dc01f3a4a2ca32ed3cec83d1e02",
"link": "https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas",
"embed": "https://embed.spotify.com/?uri=spotify:track:5nTtCOCds6I0PHMNtqelas",
"date": "2018-06-15T00:00:00.000Z",
"description": "description of a podcast episode"
}
When a field can't be retrieved, the value will be undefined
.
There are no guarantees about the shape of this data, because it varies with different media and scraping methods. Handle it carefully.
spotify-url-info © microlink.io, released under the MIT License.
Authored by Karl Sander and maintained by Kiko Beats with help from contributors.
microlink.io · GitHub microlink.io · Twitter @microlinkhq
FAQs
Get metadata from Spotify URLs
The npm package spotify-url-info receives a total of 4,728 weekly downloads. As such, spotify-url-info popularity was classified as popular.
We found that spotify-url-info demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.