Php YouTube API搜索精确短语

Php YouTube API搜索精确短语,php,search,youtube-api,feed,Php,Search,Youtube Api,Feed,我正在使用YouTube PHP API检索一个提要,该提要搜索确切的术语“超级碗广告” 然而,我有时会在feed中获得不相关的视频 $searchTerms存储搜索查询 $searchTerms2 = str_replace(" ","+",$searchTerms); $searchTerms2 = '"' . $searchTerms2 . '"'; $query->setVideoQuery($searchTerms2); 有人知道这个问题的解决方案吗?参考资料:要搜索准确的短

我正在使用YouTube PHP API检索一个提要,该提要搜索确切的术语“超级碗广告”

然而,我有时会在feed中获得不相关的视频

$searchTerms存储搜索查询

$searchTerms2 = str_replace(" ","+",$searchTerms);
$searchTerms2 = '"' . $searchTerms2 . '"';

$query->setVideoQuery($searchTerms2);

有人知道这个问题的解决方案吗?

参考资料:
要搜索准确的短语,请将短语用引号括起来。例如,要搜索与短语“spy plane”匹配的视频,请将q参数设置为%22spy+plane%22。


所以您
urlencode
您的引号?

向我们展示完整的api链接我没有PHP示例,但只要您的url看起来像
https://gdata.youtube.com/feeds/api/videos?q=%22super+碗+广告%22&orderby=published&max results=5&v=2
应该可以。尝试调试它并输出最终url,以查看脚本中发生了什么。