YouTube API: video privacy option
How can I set a privacy option for the uploaded video? In the documentation I've found only http://code.google.com/intl/en-EN/apis/youtube/2.0/refer开发者_如何学Pythonence.html#youtube_data_api_tag_yt:private, but how can I mark video as "Unlisted"?
if you guys are doing this in PHP with Zend Gdata this is how its done:
// 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));
If you're not using any of the existing libraries (e.g., when implementing via Classic ASP), add the
<yt:accessControl action="list" permission="denied" />
in between the <entry></entry>
pair. For example:
<?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>
Reference: https://developers.google.com/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos
I don't have experience with this API, but it looks like
<yt:accessControl action='list' permission='denied'/>
is what you are after. This tag is mentioned on the same page that you linked to,
http://code.google.com/intl/en-EN/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl
Hope this helps, and please give some indication whether this suits your needs.
精彩评论