Youtube 视频统计 [英] Youtube video statistics

查看:23
本文介绍了Youtube 视频统计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式获取 YouTube 视频的详细统计信息?

Is there a way to programmatically get to the details statistics of a youtube video?

例如,使用此视频:http://www.youtube.com/watch?v=jT7_CtjEVFU

如果我点击显示视频统计信息"(在观看计数器旁边),我会得到这样的很好的信息(统计信息按钮用红色下划线):

If I click on the "show video statistics" (next to the view counter), I get nice information like this (stats button underlined in red):

起初我以为我可以通过 Youtube API 实现这一点,但似乎不可能.

At first I thought I could get to this through the Youtube API, but it doesn't seem to be possible.

接下来,我想到了手动解析数据.但是,在页面加载时,数据并不作为页面源的一部分.只有在我点击统计按钮后才会出现.

Next, I thought about parsing the data manually. However, on page load, the data isn't there as part of the page source. It appears only after I click the stats button.

在使用某些获取工具(例如 wget)时,有没有一种方法可以模拟单击按钮?我希望能够wget统计数据,然后离线解析.

Is there a way I can simulate clicking the button when using some fetching tool (like wget)? My hope is to be able to wget the statistics data and then parse it offline.

推荐答案

使用 Chrome 检查器网络选项卡,我能够看到当您单击 stats 按钮时,有一个到以下页面的 ajax 调用:

Using the Chrome inspectors network tab, I was able to see that when you click the stats button, there is an ajax call to the following page:

http://www.youtube.com/insight_ajax?action_get_statistics_and_data=1&v=######

(其中###### 是视频 ID)这似乎返回了某种 XML 文档,该文档必须由页面解析并转换为统计信息.我认为这将是您调查的一个很好的起点.

(Where ###### is the video id) That seems to return some kind of XML document which must be parsed by the page and turned into the stats readout. I think that would be a good starting point for your investigation.

我只是稍微深入了响应的第一行,它甚至不是真正的 XML,它几乎只是统计面板的 HTML.

I just looked slightly deeper beyond the first line of the response, and it's not even really XML, it's pretty much just the HTML of the stats panel.

这篇关于Youtube 视频统计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆