Php 以未列出的身份将视频上载到YouTube

Php 以未列出的身份将视频上载到YouTube,php,zend-framework,youtube,Php,Zend Framework,Youtube,因此,我可以使用PHP客户端库将视频上载到YouTube(直接上载),并将其设置为private,但是否可以将其设置为未列出?您必须将此代码用作请求XML元素的子元素: <yt:accessControl action="list" permission="denied"/> 希望这有帮助:D那样做。。使用API版本2和ZEND GDATA。 如果你看$videoEntry的内容,你会注意到 $\u扩展元素和$\u扩展属性。 从视频输入的扩展类来看 您将找到抽象类Zend_Gdat

因此,我可以使用PHP客户端库将视频上载到YouTube(直接上载),并将其设置为private,但是否可以将其设置为未列出?

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

<yt:accessControl action="list" permission="denied"/>

希望这有帮助:D

那样做。。使用API版本2和ZEND GDATA。 如果你看$videoEntry的内容,你会注意到 $\u扩展元素和$\u扩展属性。 从视频输入的扩展类来看 您将找到抽象类Zend_Gdata_App_Base 它有一个函数setExtensionElements(数组)。 因此,只有按照其他人所说的去创建accesControlElement 并将其传递给该函数。。 它是有效的

$videoEntry = $yt->getFullVideoEntry($id);

if ($videoEntry->getEditLink() !== null) {

    echo "<b>Video is editable by current user</b><br />";

    $putUrl = $videoEntry->getEditLink()->getHref();

    //set video to unlisted
    $accessControlElement = new Zend_Gdata_App_Extension_Element(
        'yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', ''
    );
    $accessControlElement->extensionAttributes = array(
        array(
            'namespaceUri' => '',
            'name' => 'action',
            'value' => 'list'
        ),
        array(
            'namespaceUri' => '',
            'name' => 'permission',
            'value' => 'denied'
        ));

    // here is the hidden function 
    // it´s on a abstract class Zend/Gdata/App/Base/Base.php 
    // Where ZEND/Gdata/Youtube/VideoEntry.php extends

    $videoEntry->setExtensionElements(array($accessControlElement));

    $yt->updateEntry($videoEntry, $putUrl);

}else{

    echo "<b>EL Video no es editable por este usuario</b><br />";

}
$videoEntry=$yt->getFullVideoEntry($id);
如果($videoEntry->getEditLink()!==null){
echo“视频可由当前用户编辑
”; $putUrl=$videoEntry->getEditLink()->getHref(); //将视频设置为未列出 $accessControlElement=新的Zend\u Gdata\u应用程序\u扩展\u元素( 'yt:accessControl','yt','http://gdata.youtube.com/schemas/2007', '' ); $accessControlElement->extensionAttributes=array( 排列( 'namespaceUri'=>'', “名称”=>“操作”, '值'=>'列表' ), 排列( 'namespaceUri'=>'', “名称”=>“权限”, '值'=>'已拒绝' )); //下面是隐藏函数 //它位于抽象类Zend/Gdata/App/Base/Base.php上 //其中ZEND/Gdata/Youtube/VideoEntry.php扩展了 $videoEntry->setExtensionElements(数组($accessControlElement)); $yt->updateEntry($videoEntry,$putUrl); }否则{ echo“EL视频编号可编辑的孔este usuario
”; }
我问的是完全相同的问题,为什么这是一个“封闭的非真实问题”?babonk询问是否可以将上传的视频设置为“未列出”。如果你有通过PHP上传到youtube的经验,这是一个可以接受的问题。5个人认为这是一个糟糕的问题。这是一个相当合法的问题,答案是:我是通过谷歌“zend upload unlisted video”来到这里的。我也同意这是一个合理的问题。是的,这不应该被关闭
$videoEntry = $yt->getFullVideoEntry($id);

if ($videoEntry->getEditLink() !== null) {

    echo "<b>Video is editable by current user</b><br />";

    $putUrl = $videoEntry->getEditLink()->getHref();

    //set video to unlisted
    $accessControlElement = new Zend_Gdata_App_Extension_Element(
        'yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', ''
    );
    $accessControlElement->extensionAttributes = array(
        array(
            'namespaceUri' => '',
            'name' => 'action',
            'value' => 'list'
        ),
        array(
            'namespaceUri' => '',
            'name' => 'permission',
            'value' => 'denied'
        ));

    // here is the hidden function 
    // it´s on a abstract class Zend/Gdata/App/Base/Base.php 
    // Where ZEND/Gdata/Youtube/VideoEntry.php extends

    $videoEntry->setExtensionElements(array($accessControlElement));

    $yt->updateEntry($videoEntry, $putUrl);

}else{

    echo "<b>EL Video no es editable por este usuario</b><br />";

}