相关文档可在此处找到:https://developers.google.com/youtube/2.0/developers_guide_protocol_captions#Create_Caption_Track
我已经尝试了以下操作,但我只是收到了一个深奥的“urllib2.HTTPError:HTTP错误401:未知的授权 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)
我是一名优秀的程序员,十分优秀!