【问题标题】:Get Youtube video by tags from specific user通过特定用户的标签获取 Youtube 视频
【发布时间】:2023-03-06 05:06:02
【问题描述】:

我正在尝试使用 $tags 从 $username 获取 youtube 视频:

$tags='detskij-sad-198';
require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
                          $username     = 'Schoolkharkovua',
                          $password     = '*****',
                          $service      = 'youtube',
                          $client       = null,
                          $source       = '*****',
                          $loginToken   = null,
                          $loginCaptcha     = null,
                          $authenticationURL);

$devkey = '*****';
$yt = new Zend_Gdata_YouTube($httpClient, '', '', $devkey);
$yt->setMajorProtocolVersion(2);
$query = $yt->newVideoQuery();
$query->setMaxResults(4);
$query->setVideoQuery($tags); // also i tried $query->category = $tags;
$query->setAuthor($username);
$videoFeed = $yt->getVideoFeed($query->getQueryUrl(2));

$videoFeed 没有返回任何条目,尽管我知道 $username 有一个带有 $tags 的视频,并且这段代码可以工作到 3 月中旬

如果我只通过 $username 或 $tags 进行查询 - 我会得到结果。 我做错了什么?

PS。 http://gdata.youtube.com/demo/index.html 如果我同时尝试通过“关键字”和“作者姓名”进行查询,也会返回空视频源

Hhhhhmmmmm....似乎“google”不再在标签中获得符号“-”

但是

echo 'Tags: ' . implode(", ", $videoEntry->getVideoTags());

还是 emty,youtube api 不返回视频标签!

请大家帮我从我的视频频道获取视频标签!

【问题讨论】:

标签: php zend-framework youtube-api feed


【解决方案1】:

您需要验证您的连接,YT 现在返回一个空的 media$keywords 对象(截至去年 8 月)。

https://developers.google.com/youtube/2.0/developers_guide_php#Authentication

这是他们的博客文章...

http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html

【讨论】:

  • 但是我已经通过ClientLogin方法认证了,还需要什么认证?
猜你喜欢
  • 2013-03-25
  • 1970-01-01
  • 2013-04-23
  • 2013-10-05
  • 1970-01-01
  • 1970-01-01
  • 2017-12-10
  • 1970-01-01
  • 2015-03-06
相关资源
最近更新 更多