To display uploaded You tube video, title views count, description Published date …
<script type="text/javascript"> function youtubeFeedCallback(data) { var s = ''; s += ' <span>'+ Math.floor(data.entry.media$group.yt$duration.seconds / 60) + ':' + (data.entry.media$group.yt$duration.seconds % 60)+'</span><br/>'; s += '<h1>' + data.entry.title.$t + '</h1>'; s += '<p>' + data.entry.yt$statistics.viewCount + ' view(s)</p>'; s += '<p>by ' + data.entry.author[0].name.$t + ' On ' + new Date(data.entry.published.$t).toLocaleDateString() + '</p>'; s += '<p>'+data.entry.media$group.media$description.$t.replace(/\n/g,'<br/>' ) +'</p><hr/>'; s += '<p><strong><a href="$videoViewMoreLink.getData()" target="_blank">View All Videos</a></strong></p></div>'; document.write(s); } </script> <script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/vR_r06JVpj8?v=2&alt=json-in-script&callback=youtubeFeedCallback"></script>
Check point:
http://www.youtube.com/watch?v=vR_r06JVpj8
for more information check the below reference link
https://developers.google.com/youtube/2.0/developers_guide_json
https://developers.google.com/youtube/js_api_reference
Advertisements
Leave a Reply