0

我在YouTube视频中搜索视频时偶尔会出现此错误,其他时候它只是起作用,但随后问题再次出现。有人可以帮我解决这个问题吗?警告来自youtube的simplexml_load_file语法分析器错误

错误消息:

Warning: simplexml_load_file(http://gdata.youtube.com/feeds/api/videos?vq=music&orderby=relevance&max-results=10&start-index=201&lr=en): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/website/public_html/search.php on line 119 

Warning: simplexml_load_file(): I/O warning : failed to load external entity "http://gdata.youtube.com/feeds/api/videos?vq=music&orderby=relevance&max-results=10&start-index=201&lr=en" in /home/website/public_html/search.php on line 119 

Fatal error: Call to a member function children() on a non-object in /home/website/public_html/search.php on line 122 

行119:

$sxml = simplexml_load_file($feedURL); 

行122:

$counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/'); 
+0

Youtube限制了您的自动请求,这就是为什么“偶尔”脚本不起作用...使用youtube api代替 - https://developers.google.com/youtube/v3/ –

+0

使用api-key修复。谢谢@Tuga! – neogeo

+0

总是乐于提供帮助,如果可能,请将答案标记为正确。 –

回答

0

YouTube是限制你的自动化要求,这就是为什么 “偶尔” 的剧本没有按”吨工作...使用youtube api来代替。

相关问题