YouTube 视频统计
有没有办法以编程方式获取 YouTube 视频的详细统计信息?
例如,使用以下视频:http://www.youtube.com/watch?v=jT7_CtjEVFU
如果我点击“显示视频统计信息”(在观看计数器旁边),我会得到这样的好信息(统计按钮以红色下划线显示):
起初我以为我可以通过 Youtube API 来实现这一点,但这似乎不可能。
接下来,我想到了手动解析数据。但是,在页面加载时,数据并不作为页面源的一部分。仅在我单击统计按钮后才会出现。
有没有办法可以在使用某些获取工具(例如 wget
)时模拟单击按钮?我的希望是能够wget
统计数据,然后离线解析它。
Is there a way to programmatically get to the details statistics of a youtube video?
For example, using this 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):
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Chrome 检查器网络选项卡,我能够看到当您单击统计按钮时,有一个对以下页面的 ajax 调用:(
其中 ###### 是视频 id)这似乎返回某种XML 文档必须由页面解析并转换为统计读数。我认为这将是你调查的一个很好的起点。
编辑:我只是稍微深入了一下响应的第一行,它甚至不是真正的 XML,它几乎只是统计面板的 HTML。
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:
(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.
Edit: 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.