python - 如何从 Youtube 检索喜欢/不喜欢/观看次数?

标签 python youtube youtube-api

我想从 YouTube 视频中获取一些关于“喜欢”、“不喜欢”、“观看”的最小统计信息<强>计数。但是,到目前为止,我可以检索视频信息的 JSON,但没有上述信息。

最佳答案

因此,在不使用 Google API 和执行任何 O-AUTH 的情况下,我只是解析网站并获取点赞计数和标题

导入请求 导入重新

filesInChannel = [
"https://www.youtube.com/watch?v=PYuNBFdwK7k",
"https://www.youtube.com/watch?v=-Ox9MvottBI"
]

def getStats(link):
    page = requests.get(link)
    likes = re.search("with (\d*.\d*.\d*)", page.text).group(1)
    title = re.search("property=\"og:title\" content=\"([^\n]*)", page.text).group(1)
    return (likes, title)


for link in filesInChannel:
    stats = getStats(link)
    print stats[0].encode("utf-8") + " " + stats[1].encode("utf-8")

关于python - 如何从 Youtube 检索喜欢/不喜欢/观看次数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32940484/

相关文章:

python - 无法加载 Subversion python 绑定(bind)

python - 属性错误 : 'int' object has no attribute 'copy'

youtube - 即使使用有效 token ,YouTube上的上传操作也会失败,出现 “insufficientPermissions”

javascript - YouTube iFrame API 视频在移动设备上间歇性播放

java - YouTube 自动生成的字幕文件具有非顺序时序

python - 在 python + picamera + opencv 的线程内使用 "with"

python - 创建矩阵(数组),其中每个元素本身就是一个矩阵

javascript - YouTube 自动播放并静音

youtube-api - YouTube 数据 API 的批量请求是否有效?

javascript - YouTube API 不适用于 iPad/iPhone/非 Flash 设备