【发布时间】:2011-12-11 08:55:31
【问题描述】:
我在使用 Python YouTube API 获取播放列表中视频的标题时遇到了一点问题。我已经正确配置了环境,当我从 API 文档中复制示例时,它也适用于添加的播放列表 ID,但是当我尝试使用其他播放列表中的一个时,出现错误。
这是我写的一些代码:(在这个例子中,我尝试获取视频的标题from here)
import gdata.youtube
import gdata.youtube.service
yt_service = gdata.youtube.service.YouTubeService()
yt_service.ssl = True
# a typical playlist URI
playlist_uri = "http://gdata.youtube.com/feeds/api/playlists/PLCD939C4D974A5815"
playlist_video_feed = yt_service.GetYouTubePlaylistVideoFeed(playlist_uri)
# iterate through the feed as you would with any other
for playlist_video_entry in playlist_video_feed.entry:
print playlist_video_entry.title.text
这是我得到的错误:
RequestError: {'status': 400, 'body': 'Invalid playlist id', 'reason': 'Bad Request'}
我对此感到非常沮丧,希望能得到一些帮助。谢谢!
【问题讨论】:
标签: python api youtube-api