YouTube API搜索精确短语


YouTube API Search for Exact Phrase

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

然而,我有时会在提要中看到不相关的视频。

$searchTerms存储搜索查询。

$searchTerms2 = str_replace(" ","+",$searchTerms);
$searchTerms2 = '"' . $searchTerms2 . '"';
$query->setVideoQuery($searchTerms2);

有人知道这个问题的解决办法吗?

来自参考:To search for an exact phrase, enclose the phrase in quotation marks. For example, to search for videos matching the phrase "spy plane", set the q parameter to %22spy+plane%22.

所以你用引号urlencode