$homepage = file_get_contents('https://gdata.youtube.com/feeds/api/videos?q='.urlencode($dz_izpilditajs).'%20-%20'.urlencode($dz_nosaukums).'&orderby=relevance&start-index=1&max-results=1&v=2&alt=json');
$ytraw=json_decode($homepage, true);
$here = explode(":", $ytraw['feed']['entry'][0]['id']['$t']);
$num = (count($here) - 1);
$yt = $here[$num];
Vairāk info šeit:
https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters?hl=cs