Node-ytdl-core: Thumbnail is missing in getInfo() - YouTube code updated

Created on 6 Jun 2019  路  3Comments  路  Source: fent/node-ytdl-core

Hi,

I think YouTube has updated its code !
Indeed since this morning I can not manage to recover the thumbnail of video.

I use the latest ytdl-core.

My package.json :

{
  "main": "index.js",
  "dependencies": {
    "ytdl-core": "0.29.2"
  }
}

When I try to get thumbnail with:

const ytdl = require('ytdl-core');
ytdl.getInfo("https://www.youtube.com/watch?v=FgeRDFai3C4", (err, info) => {
  console.log(info.thumbnail_url);
})

In console I have : "undefined"

See this demo : https://repl.it/repls/DentalLightyellowOop

Looking a little I saw that the thumbnail was in the node "player-response" (console.log(info.player-response))

But we can not access it.

Thanks for your help,

Barbhackk

Most helpful comment

The available thumbnails are in info.player_response.videoDetails.thumbnail.thumbnails. It's what I personally have been using to get the video thumbnail. (The last element of the array will always have the thumbnail with "higher" resolution, which isn't actually the highest res YouTube has, it's still a very small image, but I'm afraid that's the best we can get.

I'm not sure if this URL always works or if it will keep working but... if you need the maximum resolution thumbnail you can try getting it from https://img.youtube.com/vi/${videoID}/maxresdefault.jpg, replacing ${videoID} with the id of the video, eg: https://img.youtube.com/vi/FgeRDFai3C4/maxresdefault.jpg or also https://i.ytimg.com/vi/FgeRDFai3C4/maxresdefault.jpg

Note: This might not work for all videos, as we've seen in issue #155. And some resolutions might include black bars.

All 3 comments

The available thumbnails are in info.player_response.videoDetails.thumbnail.thumbnails. It's what I personally have been using to get the video thumbnail. (The last element of the array will always have the thumbnail with "higher" resolution, which isn't actually the highest res YouTube has, it's still a very small image, but I'm afraid that's the best we can get.

I'm not sure if this URL always works or if it will keep working but... if you need the maximum resolution thumbnail you can try getting it from https://img.youtube.com/vi/${videoID}/maxresdefault.jpg, replacing ${videoID} with the id of the video, eg: https://img.youtube.com/vi/FgeRDFai3C4/maxresdefault.jpg or also https://i.ytimg.com/vi/FgeRDFai3C4/maxresdefault.jpg

Note: This might not work for all videos, as we've seen in issue #155. And some resolutions might include black bars.

The available thumbnails are in info.player_response.videoDetails.thumbnail.thumbnails. It's what I personally have been using to get the video thumbnail. (The last element of the array will always have the thumbnail with "higher" resolution, which isn't actually the highest res YouTube has, it's still a very small image, but I'm afraid that's the best we can get.

I'm not sure if this URL always works or if it will keep working but... if you need the maximum resolution thumbnail you can try getting it from https://img.youtube.com/vi/${videoID}/maxresdefault.jpg, replacing ${videoID} with the id of the video, eg: https://img.youtube.com/vi/FgeRDFai3C4/maxresdefault.jpg or also https://i.ytimg.com/vi/FgeRDFai3C4/maxresdefault.jpg

Note: This might not work for all videos, as we've seen in issue #155. And some resolutions might include black bars.

Thanks @BrunoMoreira99 it's works now.

@BrunoMoreira99 Thanks a lot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PKPear picture PKPear  路  4Comments

cloudrac3r picture cloudrac3r  路  5Comments

atherdon picture atherdon  路  5Comments

arcovoltaico picture arcovoltaico  路  6Comments

adamwoo2444 picture adamwoo2444  路  5Comments