Reputation: 21896
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.
Upvotes: 1
Views: 1564
Reputation: 3542
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=######
(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.
Upvotes: 6