If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?
If you want to get rid of the "black bars" and do it like YouTube does it, you can use:
https://i.ytimg.com/vi_webp/
And if you can't use the .webp
file extension you can do it like this:
https://i.ytimg.com/vi/
Also, if you need the unscaled version, use maxresdefault
instead of mqdefault
.
Note: I'm not sure about the aspect ratio if you're planning to use maxresdefault
.