views:

3095

answers:

3

Hi,

i want to pass a youtube url to maybe youtube's api and get the video tumbnail using php & curl ? is that possible?

Thanks

+11  A: 

Each YouTube video has 3 generated images. They are predictably formatted as follows:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg

Alternatively, you can use the YouTube API to get thumbnail images.

Asaph
Thanks Asaph :)
David
The 0 image is a full size image of the video: `http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg`
munissor
A: 

Hi, You can get the Video Entry which contains the URL to the video's thumbnail. There's example code in the link. Or, if you want to parse XML, there's information here. The XML returned has a media:thumbnail element, which contains the thumbnail's URL.

keyboardP
+1  A: 

You can use read-only feeds from YouTube Data API to retrieve video thumbnails, caption, description, rating, statistics and more via AJAX. Its explained here:

Retrieve Title, Description and Thumbnail of a YouTube Video Using AJAX

Salman A