我有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/

07-28 07:58