我想从YouTube视频中获得结果热门视频: http://www.google.com.tr/trends/hotvideos#geo=CA&hvsm=1 我正在使用卷曲。使用php curl获取YouTube视频流行趋势热门视频的结果
function cek($ursa){
$useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$referer = 'http://www.google.com/';
$ch = curl_init();
$zaman = 0;
curl_setopt ($ch, CURLOPT_URL, $ursa);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $zaman);
curl_setopt ($ch, CURLOPT_REFERER, $referer);
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
$rmx = curl_exec($ch);
curl_close($ch);
return $rmx;
}
$html = cek("http://www.google.com.tr/trends/hotvideos#geo=CA&hvsm=1");
echo $html;
当我得到页面卷曲我没有看到页面中的视频链接。 我怎样才能得到他们?我已经看过YouTube的API,但无法找到获得这些结果的方法。有没有办法从Youtube API获得这些结果?
请求的结果是什么? – Raptor 2015-03-25 04:24:42
@ Raptor:本网站不允许我添加它,因为结果太长。结果如下:https://justpaste.it/k5nq – r10 2015-03-25 18:53:46
明白了。我注意到你没有使用Youtube API。您应该使用API而不是获取整个YouTube页面的HTML源代码。 – Raptor 2015-03-26 01:55:33