TypeError: Couldn't find any data in embed page that we know how to parse.
buffolollo opened this issue · 3 comments
Describe the bug
TypeError: Couldn't find any data in embed page that we know how to parse.
Please report the problem at https://github.com/microlinkhq/spotify-url-info/issues.
at throwError (/home/buffolollo/DrummerTS/node_modules/spotify-url-info/src/index.js:22:9)
at /home/buffolollo/DrummerTS/node_modules/spotify-url-info/src/index.js:65:10
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Spotify URL(s)
- https://open.spotify.com/track/5M830cD7MNeiiwIGHzH9TV?si=a3a9ddbfa3534627
- https://open.spotify.com/track/5E6bTiJ2rB18M1DNqkm1V4?si=ab46872c0e454ed6
Sometimes it happens with any link
I have to try many times for it not to give this error
Your Code
const fetch = require("isomorphic-unfetch");
const spotify = require("spotify-url-info")(fetch);
const data = await spotify.getPreview(query);
const res = await searcher.search(${data.title} ${data.artist}
, {
type: "video",
limit: 1,
});
Error Message
the error is above in the description
I am reproducing this with a playlist url, https://open.spotify.com/playlist/{playlist-id}
An error occured while trying to get information from the playlist. Please restart:
TypeError: Couldn't find any data in embed page that we know how to parse.
Please report the problem at https://github.com/microlinkhq/spotify-url-info/issues.
It should be fixed now; can you test it?
npm install spotify-url-info@3.2.6
🙏
I suspect this is related with the HTML get from from the fetch request.
For debugging this, I released spotify-url-info@3.2.12
which exposes error.html
.
Can you do something like this?
try {
const data = await getPreview(url)
} catch(error) {
const filepath = `${require('os').tmpdir()}/${url}.html`
require('fs').writeFileSync(filepath, error.html)
console.log('debug file at', filepath)
}
Then upload the file to https://gist.github.com/ or whatever so we can determine what's happening 🙂