ignacio.munizaga
ignacio.munizaga

Reputation: 1603

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.

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

Thanks!

Upvotes: 2

Views: 998

Answers (1)

jslopez
jslopez

Reputation: 951

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)

Upvotes: 4

Related Questions