我正在努力一点点的语法迭代通过YouTube视频上的所有评论。我正在使用python,并且在GetYouTubeVideoCommentFeed()
函数上找到了一些文档。youtube数据API评论分页
我真正想做的是搜索一个词的实例的视频的所有评论,并增加一个计数器(最终评论将打印出来)。它对返回的25个结果起作用,但我需要访问其余的评论。
import gdata.youtube
import gdata.youtube.service
video_id = 'hMnk7lh9M3o'
yt_service = gdata.youtube.service.YouTubeService()
comment_feed = yt_service.GetYouTubeVideoCommentFeed(video_id=video_id)
for comment_entry in comment_feed.entry:
comment = comment_entry.content.text
if comment.find('hi') != -1:
counter = counter + 1
print "hi: "
print counter
我试图设置的GetYouTubeVideoCommentFeed()
的start_index
除了video_id
但它并没有这样的。
有什么我失踪了吗?
谢谢! Steve