1

The relevant documentation is found here: https://developers.google.com/youtube/2.0/developers_guide_protocol_captions#Create_Caption_Track

I've tried the following, but I simply receive an esoteric "urllib2.HTTPError: HTTP Error 401: Unknown authorization header"

import gdata.youtube, gdata.youtube.service, urllib2
yt_service = gdata.youtube.service.YouTubeService()
yt_service.ClientLogin("username@gmail.com","password")
yt_service.ProgrammaticLogin()
auth = yt_service.current_token.get_token_string()
url = "https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/captions"
req = urllib2.Request(url, "Transcript", {'Content-Type': 'application/vnd.youtube.timedtext; charset=UTF-8', 'Content-Language:': 'en', 'Authorization': auth})
f = urllib2.urlopen(req)
4

1 回答 1

1

There's a bunch of info in this blog post, including a link to this sample Python script for uploading captions.

于 2013-04-01T21:05:21.920 回答