I need to get all statistics from a Youtube channel so that I can create a document using PHP开发者_如何学C containing all of the data.
I want information such as the dates the video was viewed, if it has been liked, if it has been blogged and so on.
Is it possible to do this?
Thanks
Please see the sample code below for how you can do some of this. You can find a basic demo here. As seen, you do not necessarily need to write any PHP code to do this. More details are available in developer documents.
<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("body").append("<div id = 'data'><ul>jffnfjnkj</ul></div>");
var dataContainer = $("#data ul");
$.ajax({
url:'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?alt=jsonc&v=2&callback=?',
dataType: "jsonp",
timeout: 5000,
success: function(data){
$.each(data.data.items,
function(i, val) {
if (typeof(val.player) !== 'undefined' && typeof(val.title) !== 'undefined') {
dataContainer.append('<li><a href='+val.player["default"]+' target="_blank">'+val.title+'</a></li>');
}
});
}
});
});
});
</script>
</head>
<body>
<h2>Header</h2>
<p>Paragraph</p>
<p>Paragraph.</p>
<button>Click me</button>
</body>
</html>
精彩评论