如何通过gdata Python库获取YouTube上所有视频的列表

0 投票
2 回答
1940 浏览
提问于 2025-04-18 02:57

我在看这个文档。

https://developers.google.com/youtube/1.0/developers_guide_python#SearchingVideos

这个文档解释了在YouTube上可以进行的各种操作。

但是我不太明白,怎么才能获取一个YouTube频道里的所有视频。

我需要获取所有视频的标题、网址和缩略图。

如果有人能帮忙就太好了。

谢谢!

2 个回答

2

我从文档里找到了答案,万一有人需要的话。

yt_service = gdata.youtube.service.YouTubeService()
yt_service.ssl = True

yt_service.developer_key = 'xxx'
yt_service.client_id = 'xxx'

yt_service.email = 'xxx@dd.com'
yt_service.password = 'xxx'
yt_service.source = 'youtube'
yt_service.ProgrammaticLogin()
videos = yt_service.GetYouTubeVideoFeed("https://gdata.youtube.com/feeds/api/users/default/uploads")

然后

 for video in videos.entry
     print video

撰写回答