我正在努力学习迭代youtube视频上所有评论的语法.我正在使用python并且在GetYouTubeVideoCommentFeed()函数上找到了很少的文档.
我真正想做的是搜索视频的所有评论以获取单词的实例并增加计数器(最终将打印出评论).它对返回的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
Run Code Online (Sandbox Code Playgroud)
我试图设置start_index的GetYouTubeVideoCommentFeed()除了video_id,但它不喜欢那个.
有什么我想念的吗?
谢谢!史蒂夫