【发布时间】:2010-12-26 11:13:12
【问题描述】:
我在遍历 youtube 视频上的所有 cmets 的语法上有些吃力。我正在使用 python,但几乎没有找到关于 GetYouTubeVideoCommentFeed() 函数的文档。
我真正想做的是在视频的所有 cmets 中搜索一个单词的实例并增加一个计数器(最终将打印出评论)。它对返回的 25 个结果起作用,但我需要访问其余的 cmets。
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
除了video_id 之外,我还尝试设置GetYouTubeVideoCommentFeed() 的start_index,但它不喜欢那样。
我有什么遗漏吗?
谢谢! 史蒂夫
【问题讨论】:
标签: python youtube youtube-api