我试图弄清楚在使用youtube.service对象登录后如何从youtube.data对象获取Title属性。dblist.dbselectlist() 输出要与 uri 连接的 videoid。任何帮助不胜感激。
这是我到目前为止的代码。
import gdata.youtube
import gdata.youtube.service
import gdata.youtube.data
import dblist
# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.youtube.service.YouTubeService()
# Authenticate using your Google Docs email address and password.
client.email = 'email@outlook.com'
client.password = 'pwdvalue'
client.source = 'my-list-application'
client.developer_key = 'xxxxx'
client.client_id = 'my-list-application'
client.ProgrammaticLogin()
#select all videoids in the rotatevids table
listrotate = dblist.dbselectrotatelist()
for row in listrotate:
videoid= row["videoid"]
uri = 'https://gdata.youtube.com/feeds/api/videos/%s?v=2' % (videoid)
print uri
video_feed = client.GetYouTubeVideoFeed(uri)
当我dir(gdata.youtube.data.VideoEntry)看起来它有我正在寻找的标题和文本值
提前致谢
video_entry = client.GetYouTubeVideoEntry(video_id=VIDEO_ID)
title = video_entry.title.text
顺便说一句,我认为程序化登录已被弃用(https://developers.google.com/youtube/2.0/developers_guide_protocol_clientlogin),无论如何您都不需要登录,它只需要开发人员密钥。