我使用python进行API调用,根据某人的频道ID检索Youtube播放列表。以下是我被指示作为代码的内容:
import gdata.youtube
import gdata.youtube.service
youtube_service = gdata.youtube.service.YouTubeService()
playlist = raw_input("Please enter the user ID: ")
url = "http://gdata.youtube.com/feeds/api/users/"
playlist_url = url + playlist + "/playlists"
video_feed = youtube_service.GetYouTubePlaylistVideoFeed(playlist_url)
print "\nPlaylists for " + str.format(playlist) + ":\n"
for p in video_feed.entry:
print p.title.text
运行代码后,我收到一个响应错误,看起来像这样。
gdata.service.RequestError: {'status': 410, 'body': 'No longer available', 'reason': 'Gone'}
在深入研究此问题之后,这是因为使用了一个不推荐使用的API(v2)。此代码的目的是基本列出提示给用户的youtube频道ID的播放列表。如何将其转换为可根据v3 API运行的代码?
编辑:没关系,这不是维护,这是旧版本!