我正在尝试使用youtube.service对象记录如何从youtube.data对象获取Title属性。 dblist.dbselectlist()输出要与uri连接的视频。任何帮助表示赞赏。
这是我到目前为止的代码。
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) 看起来它有标题和文字值我正在寻找希望
提前致谢
答案 0 :(得分:0)
video_entry = client.GetYouTubeVideoEntry(video_id=VIDEO_ID)
title = video_entry.title.text
btw我认为ProgrammaticLogin已弃用(https://developers.google.com/youtube/2.0/developers_guide_protocol_clientlogin),无论如何都不需要登录,只需要开发人员密钥。