2010-12-10 76 views

回答

4

,如果你們在PHP與Zend的GData這樣做,這是它如何做的:

// create a new video 
$video = new Zend_Gdata_YouTube_VideoEntry(); 
$video->setVideoTitle('My Test Movie'); 
$video->setVideoDescription('My Test Movie'); 
$video->setVideoCategory('Animals'); 
$video->SetVideoTags('tag1, tag2'); 

// make video unlisted 
$unlisted = new Zend_Gdata_App_Extension_Element('yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', ''); 
$unlisted->setExtensionAttributes(array(
    array('namespaceUri' => '', 'name' => 'action', 'value' => 'list'), 
    array('namespaceUri' => '', 'name' => 'permission', 'value' => 'denied') 
)); 
$video->setExtensionElements(array($unlisted)); 
+1

工作很好,謝謝。 – haudenschilt 2012-01-27 18:33:51

1

如果你不使用任何現有的庫(例如,通過傳統的ASP執行時),加

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

<entry></entry>之間。例如:

<?xml version="1.0"?> 
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"> 
    <media:group> 
     <media:title type="plain">Video Title Here</media:title> 
     <media:description type="plain">Video Description Here</media:description> 
     <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Person</media:category> 
     <media:keywords>Video Keywords Here</media:keywords> 
    </media:group> 
    <yt:accessControl action="list" permission="denied" /> 
</entry> 

參考:https://developers.google.com/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos