3.2.13 • Published 2 months ago

spotify-url-info v3.2.13

Weekly downloads
17,288
License
MIT
Repository
github
Last release
2 months ago

Last version Coverage Status NPM Status

Get metadata from Spotify URLs.

Install

npm install spotify-url-info

Usage

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.

License

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

@bleah/discord-playermodified-discord-playermqoproboimirilegenidiscord-mpdlc.jsmusic-player-akumis@casper124578/discord-playerchatdevs.jshydraop.jssimplify-discordbotsabycompany.jsscythe-musicbetteroiunicordaoi.js-light@koushikpuppala/musics_dj@infinitebrahmanuniverse/nolb-spodiscord-player-play-dlbloombotmagneumdiscord-player-now@everything-registry/sub-chunk-2808sourcream-utilsspdl-corespotitubedbd.js-newdbd.jsdbd.js-demo@discord-player/extractor@discordx/plugin-ytdl-player@distube/spotifydos-apidiscord-player-clonediscord-player-plusdiscord-player-plus2discord-player-simplediscord-player-tlndxlrddiscord-music-playerdiscord-music-player-atdiscord-music-player-customdismusicdistube-spotifydiscord-portable-playerdiscordjs-ytdl-advancedtrack-resolverurl-song-utilitiesvideo-extractorchatdev.jstesting-aoirache.dbdspike-playerspotify-temp-fixspotify-to-ytclone-musicdsc-music@kaname-png/erela.js-spotify@kakachi/anbumewzic-spotify@jadestudios/discord-music-playerwio-spotifytytutilbenilegenierisai.jsfrixxkazutomusickosa-discord-playergbspck-coregbspcka-coregbspckp-coreghostaox.jsjoybangla-ytifa.jsmusic-downloadermusic-downloader-clinecroatomicbotnekobotneks-playermetascraper-spotifylolkj.jsnovabot.jsplaydl-music-extractorplayer-engineshoukaku-spotify@themondon/discord-player-v13shadowmusics@andy1210/discord-player@arthestn/discord-music-player@arahiko-ayami/spotifyanos.jssanzdevmusic@tireoz/spotifyadbd.js@akarui/aoi.musicaccoraby.jssabrbot-playerandroier.jsaxo.jsexgraal@rafateoli/discord-music-player
3.2.13

2 months ago

3.2.12

3 months ago

3.2.11

3 months ago

3.2.9

6 months ago

3.2.10

5 months ago

3.2.6

9 months ago

3.2.8

7 months ago

3.2.7

7 months ago

3.2.5

11 months ago

3.2.4

11 months ago

3.1.10

1 year ago

3.2.0-0

1 year ago

3.2.2

1 year ago

3.2.1

1 year ago

3.2.0

1 year ago

3.2.3

1 year ago

3.1.9

2 years ago

3.1.8

2 years ago

3.1.7

2 years ago

3.1.6

2 years ago

3.1.5

2 years ago

3.1.3

2 years ago

3.1.4

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

2.2.9

2 years ago

2.2.8

2 years ago

3.0.0

2 years ago

2.2.7

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.2.6

2 years ago

2.2.1-0

3 years ago

2.2.1

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago