Skip to content Skip to sidebar Skip to footer

Upload A Video To Youtube Using The Python Api And Set It As Unlisted

I'm using the python client library to upload videos to youtube. I need to the set it's privacy as unlisted, but the API page only shows examples of how to set them as private. Any

Solution 1:

The XML element that you need is described in http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl

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)

Post a Comment for "Upload A Video To Youtube Using The Python Api And Set It As Unlisted"