将视频作为不公开内容上传到YouTube

Joh*_*ohn 18 php youtube zend-framework

因此,我可以使用PHP客户端库将视频上传到YouTube(直接上传)并将其设置为私有,但是是否可以将其设置为不公开?

JDu*_*eDJ 5

您必须将此代码用作请求的XML元素的子代:

<yt:accessControl action="list" permission="denied"/>
Run Code Online (Sandbox Code Playgroud)

如果你不能手动添加它(通常使用zend),你可以使用这段代码添加相应的zend条目:

//Creates an extension to Zend Framework
$element = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', ''); 

//Adds the corresponding XML child/attribute
$element->extensionAttributes = array(array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied')); 

//Adds this extension to you video entry where "$myVideo" is your video to be uploaded
$myVideo->extensionElements = array($element); 
Run Code Online (Sandbox Code Playgroud)

希望这会有所帮助:D