我想使用YouTube php数据API搜索视频,但我的目的是仅显示授权的嵌入式视频。我尝试使用setFormat
方法,但对我而言不起作用!
这是我的代码:
<?php
$searchQuery = $yt->newVideoQuery();
$searchQuery->setVideoQuery($query);
$searchQuery->setCategory('Music');
$searchQuery->setMaxResults(10);
$searchQuery->setFormat(5); //ICI
echo $searchQuery->getQueryUrl(2);
$videoFeed = $yt->getVideoFeed($searchQuery->getQueryUrl(2));
....
?>
但是我仍然会得到非嵌入式授权视频。
有任何想法吗?
最佳答案
查看以下链接:Use the YouTube API with PHP。他们使用数据API很好地搜索了YouTube视频。
关于php - YouTube搜索API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8361998/