Hey,
I wanted to know if there is a script that will add youtube videos automatically (Or set to search daily) that contain certain words?
This is to add youtube videos for my local area, so I would be searching by the city name.
Thanks
Hey,
I wanted to know if there is a script that will add youtube videos automatically (Or set to search daily) that contain certain words?
This is to add youtube videos for my local area, so I would be searching by the city name.
Thanks
Have you looked at the API ?
<?php
function youTubeVideoFeed($keywords, array $params = array()){
return new SimpleXMLElement(
'http://gdata.youtube.com/feeds/api/videos?v=2&' . http_build_query(array('q' => urlencode($keywords)) + $params),
null,
true
);
}
$videos = youTubeVideoFeed('derry ireland', array('orderby' => 'relevance', 'format' => 5, 'max-results' => 5));
foreach($videos->entry as $video){
printf("<a href=\\"%s\\">%s</a>\
", $video->link[0]['href'], htmlentities($video->title));
}
/*
<a href="http://www.youtube.com/watch?v=EKWWJog-Hbk&feature=youtube_gdata">A DRIVE AROUND DERRY CITY, IRELAND (part one)</a>
<a href="http://www.youtube.com/watch?v=I0Qc4Cg5glY&feature=youtube_gdata">Ireland / Derry</a>
<a href="http://www.youtube.com/watch?v=B4uIM0VPUXE&feature=youtube_gdata">VINNY COYLE, DERRY . Civil Rights.IRELAND</a>
<a href="http://www.youtube.com/watch?v=CN7K7GNa7O0&feature=youtube_gdata">"SHADOW BOXER IN NEW YORK" with "Ireland's JOHN DUDDY", The Derry Destroyer!</a>
<a href="http://www.youtube.com/watch?v=oY62RZpoCZo&feature=youtube_gdata">(London)Derry. City and Murals. Northern Ireland</a>
*/
?>
Nice one, i could use this. Thank’s
Hey Anthony,
Thanks very much for the reply
I will have to read up about the API, I’m not sure how it works through that code.
Does that search/display videos automatically with the search term?
Thanks again Anthony