Closed kratoskp closed 3 years ago
I just tested this on my machine (macOS) with both a m.youtube link and a normal link and the information is being correctly parsed/returned, can you maybe share a bit more details? share the full text you are trying to fetch, which device are you using, are you sure you are not behind a firewall or a filter?
Closing this, cannot reproduce and the issue is missing information such a reproducible example or the environment where this is failing
I had the same issue with the latest version and could not find any reasonable explanation. Ended up adding the following lines to build/index.js
line 81.
if (images.length <= 0 && rootUrl.indexOf(`youtube.com`) >= 0) {
const videoId = urlObj.parse(rootUrl, true).query[`v`];
images.push(`https://i.ytimg.com/vi/${videoId}/maxresdefault.jpg`)
}
can you provide a reproducible example? use a codepen or something, or more information on the environment where this is happening
I've managed to reproduce the issue, it is happening on the iOS simulator, this however doesn't seem to be a problem with this package, but rather the youtube redirection layer, it probably takes a look at the user-agent value and return the mobile youtube response.
Not sure how to tackle it, I'll create another issue but doubt I can work on it
Take a look #78, next time you open an issue and want support better add all information
Describe the bug Youtube link return as website.
To Reproduce Steps to reproduce the behavior:
getLinkPreview(link) .then(data => { console.log(data });
Expected behavior Returns
{ url: "https://www.youtube.com/watch?v=MejbOFk7H6c", title: "OK Go - Needing/Getting - Official Video - YouTube", siteName: "YouTube", description: "Buy the video on iTunes: https://itunes.apple.com/us/album/needing-getting-bundle-ep/id508124847 See more about the guitars at: http://www.gretschguitars.com...", images: ["https://i.ytimg.com/vi/MejbOFk7H6c/maxresdefault.jpg"], mediaType: "video.other", contentType: "text/html; charset=utf-8" videos: [], favicons:["https://www.youtube.com/yts/img/favicon_32-vflOogEID.png","https://www.youtube.com/yts/img/favicon_48-vflVjB_Qk.png","https://www.youtube.com/yts/img/favicon_96-vflW9Ec0w.png","https://www.youtube.com/yts/img/favicon_144-vfliLAfaB.png","https://s.ytimg.com/yts/img/favicon-vfl8qSV2F.ico"] }
Screenshots