TooTallNate / spotify-uri

Parse and format the various Spotify URI formats
MIT License
70 stars 16 forks source link

invalid spotify URLs #33

Closed Kikobeats closed 1 year ago

Kikobeats commented 1 year ago

This URL used to be valid:

const spotifyURI = require('spotify-uri')

const url = 'https://open.spotify.com/user/sophiemsmsmsm/playlist/3Q4cPwMHY95ZHXtmcU2xvH'
const parsedUrl = spotifyURI.parse(url)
const embedUrl = spotifyURI.formatEmbedURL(parsedUrl)

console.log(embedUrl) // => 'https://embed.spotify.com/?uri=spotify:user:sophiemsmsmsm:playlist:3Q4cPwMHY95ZHXtmcU2xvH'

However, It seems Spotify made some change in their URLs schema, making these URLs don't work at this moment:

CleanShot 2023-09-08 at 11 05 56@2x

kind of fund it's a Next.js app 😆

Not sure if they can turned into something that works?

Kikobeats commented 1 year ago

This is the new format: https://open.spotify.com/embed/playlist/3Q4cPwMHY95ZHXtmcU2xvH

Kikobeats commented 1 year ago

Ok, less drama: https://open.spotify.com/user/sophiemsmsmsm/playlist/3Q4cPwMHY95ZHXtmcU2xvH' redirect into 'https://open.spotify.com/playlist/3Q4cPwMHY95ZHXtmcU2xvH' and that is working fine.

So this is still working if the final URL from Spotify is used 👍