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
This package can fetch useful metdata for spotify urls without needing a spotify API key. This is accomplished by some very light scraping. My usecase is providing a customized mini player preview.
Warning: This library will not work directly in the browser, because the spotify page that it scrapes does not allow cross-origion requests. You can use it in node.js, in serverless functions and in react native. Alternatively use a CORS proxy.
npm install spotfiy-url-info
var { getData, getPreview } = require("spotify-url-info");
There are two functions: getData provides the full available data, in a shape that is very similar to what the spotify API returns and 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. Both take a spotify URL (play. or open.) as input and return a Promise.
await getData("https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas");
await getPreview("https://open.spotify.com/track/5nTtCOCds6I0PHMNtqelas");
returns
{
"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-15",
"description": "description of a podcast episode"
}
The fields description
and date
will be undefined for some types of media that don't have this information.
This uses cheerio to scrape the spotify twitter widget so it is unsanctioned and likely to break. I'll have the tests run on a schedule on travis ci so that I get notified when it will inevitably break. Then I can hopefully fix it. A more stable alternative is scraping the opengraph tags for the links with open-graph-scraper. The biggest issues there are no audio previews for artists and the number of requests it can take to get all the needed metadata.
description
and date
fields in the preview object (contributed by @kikobeats)getPreview
result2.0.0
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.