php - YouTube API:如何启用获利

标签 php video youtube youtube-api

我有php youtube上传脚本。很好,但是所有上传的视频均已关闭,无法通过获利功能进行。上传视频时,可以通过API获利吗?这是我的上传代码的一部分:

$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);

$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource('video.mp4');
$filesource->setContentType('video/quicktime');
$filesource->setSlug('video.mp4');
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory('Autos');
// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry->SetVideoTags('personal');
// set some developer tags -- this is optional
// (see Searching by Developer Tags for more details)
$myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag'));


  // upload URI for the currently authenticated user
  $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
  // try to upload the video, catching a Zend_Gdata_App_HttpException,
  // if available, or just a regular Zend_Gdata_App_Exception otherwise
  try {
  $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
  } catch (Zend_Gdata_App_HttpException $httpException) {
   echo $httpException->getRawResponseBody();
  } catch (Zend_Gdata_App_Exception $e) {
  echo $e->getMessage();

可以,但已关闭上载视频的获利功能。我尝试一些
 $myVideoEntry->setVideoEarning('1');

但这不起作用。

上传后手动开启获利功能时,这是功能,但我需要自动进行。

有任何想法吗?

最佳答案

我相信您可以使用Google Content Owner API启用获利(“声明”),拥有Content Owner帐户的人可以使用。

https://developers.google.com/youtube/partner/

关于php - YouTube API:如何启用获利,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23920566/

相关文章:

php - 如何从类外部调用父方法?

javascript - 移动 YouTube 页面如何在 iOS 上自动播放视频?

在Linux中从一张图像更新创建电影

php - 如何在php中使用不同的表字段分别插入pdf和video

php - 在foreach中使用Curl

objective-c - 在 UITableViewCell : How to cache to prevent reload? 中嵌入 YouTube 视频

php一次将数据插入具有多个ID的数据库?

php - 检查多维数组中的键值对

php - Mysql Feed 在 html/php 中制作表格

javascript - Android webView - 从 URL 自动播放 youtube 视频