PHP : How to grab thumbnails for youtube and google video

From : http://www.scottklarr.com/topic/415/how-to-grab-thumbnails-for-youtube-and-google-video/

// Youtube Thumbnail URL
http://img.youtube.com/vi/VIDEO_ID/default.jpg

// Google Video Feed URL
http://video.google.com/videofeed?docid=VIDEO_ID

// Snippet :

$match = array(); 
preg_match("/media:thumbnail url="([^"]S*)"/siU",$XML_SOURCE,$match); echo $match[1][0];

// To retrieve the first google video ID from html:

$match = array(); preg_match("/http:\/\/video.google.com\/googleplayer\.swf\?docid=([^"][a-zA-Z0-9-_]+)[&"]/siU",$HTML_SOURCE,$match); echo $match[1];

// To retrieve the first youtube video ID from html:

$match = array();
preg_match("/http:\/\/www.youtube.com\/v\/([^"][a-zA-Z0-9-_]+)[&"]/siU",$HTML_SOURCE,$match); 
echo $match[1];

Processing your request, Please wait....

No Responses to “PHP : How to grab thumbnails for youtube and google video”

Comments (Your Comments)

Leave a Reply

You must be logged in to post a comment.