使用 python API 将视频上传到 Youtube 并将其设置为不公开 [英] Upload a video to Youtube using the python API and set it as unlisted

查看:47
本文介绍了使用 python API 将视频上传到 Youtube 并将其设置为不公开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 python 客户端库将视频上传到 youtube.

I'm using the python client library to upload videos to youtube.

我需要将其隐私设置为不公开,但 API 页面 仅显示了如何将它们设置为私有的示例.

I need to the set it's privacy as unlisted, but the API page only shows examples of how to set them as private.

有人知道如何更改这些视频的隐私控制吗?

Anyone knows how to change the privacy control of these videos?

谢谢!

推荐答案

http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl

按照 API 文档,您可以按如下方式构建此元素:

Following the API documentation, you can build this element as follows:

from gdata.media import YOUTUBE_NAMESPACE
from atom import ExtensionElement

# set video as unlisted
kwargs = {
    "namespace": YOUTUBE_NAMESPACE,
    "attributes": {'action': 'list', 'permission': 'denied'},
}
extension = ([ExtensionElement('accessControl', **kwargs)])

# create the gdata.youtube.YouTubeVideoEntry
video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group,
    geo=where, extension_elements=extension)

这篇关于使用 python API 将视频上传到 Youtube 并将其设置为不公开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆