我正在使用 Youtube API 上传一些视频,但我不知道如何将上传的视频添加到特定的播放列表。我在谷歌上搜索过,我根本没有找到任何帮助。
我已经阅读了开发人员指南,发现了这个 - https://developers.google.com/youtube/2.0/developers_guide_php#Adding_a_Playlist_Video,但我不知道如何定义我希望脚本添加到哪个现有播放列表的视频。
这是我现在用来上传视频的:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$developerKey = 'MYDEVKEY';
$applicationId = 'SOMEID';
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = 'user',
$password = 'pass',
$service = 'youtube',
$client = null,
$source = 'something',
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$clientId = 'something';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$videoName = "video/user_12345.mov";
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource($videoName);
$filesource->setContentType('video/quicktime');
$filesource->setSlug('video/test.mov');
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle('Video title');
$myVideoEntry->setVideoDescription('Video description');
$myVideoEntry->setVideoCategory('Autos');
$myVideoEntry->SetVideoTags('car');
$uploadUrl ='https://uploads.gdata.youtube.com/feeds/users/default/uploads';
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
$state = $newEntry->getVideoState();
$idv = $newEntry->getVideoId();