microlinkhq / spotify-url-info

Get metadata from any Spotify URL.
MIT License
72 stars 16 forks source link

Error: Couldn't find any data in embed page that we know how to parse #102

Closed robotzurg closed 2 years ago

robotzurg commented 2 years ago

Describe the bug When trying to pull data from a spotify URL, I get the error "Couldn't find any data in embed page that we know how to parse"

Spotify URL(s) https://open.spotify.com/track/6Wz9kNEppcp9U6jHptH6sQ, though it happens with every single spotify URL I've tried

Your Code await getData(trackLink).then(data => { url = data.external_urls.spotify; data.type == 'track' ? songArt = data.album.images[0].url : songArt = data.images[0].url; name = data.name; artists = data.artists.map(artist => artist.name); if (data.type == 'track' || data.type == 'single') { trackUris.push(data.uri); // Used to add to playlist } else if (data.type == 'album') { for (let i = 0; i < data.tracks.items.length; i++) { trackUris.push(data.tracks.items[i].uri); } if (!name.includes(' EP') && !name.includes(' LP')) { name = (data.album_type == 'single') ? name += ' EP' : name += ' LP'; } } }).catch((err) => { console.log(err); });

Error Message Error: Couldn't find any data in embed page that we know how to parse

Kikobeats commented 2 years ago

It's working to me with that URL; are you using the latest version?

hldup commented 2 years ago

Same issue for me, but its really weird. When I paste the url into the code it works just right. But when I try to use it with a const or a with a template literal it breaks.

Kikobeats commented 2 years ago

can you try to reproduce at runkit.com or create a repo with the code?

retrouser955 commented 2 years ago

Having the same error. My code is

(async () => {
    const fetch = (await import('node-fetch')).default
    const { getData } = require('spotify-url-info')(fetch)
    getData('https://open.spotify.com/track/0FowurLmy00UXD1irHoGpm?si=24eb4343b8e14765').then(console.log)
})()

It is a really weird error. It works on runkit but not on my local machine

Update: I also tried with isomorphic-unfetch and still having the same issue

retrouser955 commented 2 years ago

Update: It's working! It seems that Spotify is not returning data due to my location. After using a VPN, everything worked!