get youtube video thumbnail from url code example

Example 1: youtube video image


https://img.youtube.com/vi//mqdefault.jpg


https://img.youtube.com/vi//default.jpg
https://img.youtube.com/vi//0.jpg
https://img.youtube.com/vi//1.jpg
https://img.youtube.com/vi//2.jpg
https://img.youtube.com/vi//3.jpg

Example 2: how toget image from a youtube video url

| Thumbnail Name      | Size (px) | URL                                              |
|---------------------|-----------|--------------------------------------------------|
| Player Background   | 480x360   | https://i1.ytimg.com/vi/

Example 3: How do I get a YouTube video thumbnail from the YouTube API?

$data = file_get_contents("https://www.googleapis.com/youtube/v3/videos?key=YOUR_API_KEY&part=snippet&id=T0Jqdjbed40");
$json = json_decode($data);
var_dump($json->items[0]->snippet->thumbnails);

Tags:

Misc Example