相关文档可在此找到:https://developers.google.com/youtube/2.0/developers_guide_protocol_captions#Create_Caption_Track
我尝试了以下内容,但我只是收到一个深奥的"urllib2"。HTTPError: HTTPError 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)
这篇博客中有很多信息,包括一个链接到这个示例Python脚本,用于上传标题