我正在尝试使用YouTube API v2.0 提取最新的 YouTube 实时事件源 - 检索实时事件 但我的脚本似乎不起作用。这是我的代码。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</head>
<body>
<div id="static_video"></div>
<script>
$(document).ready(function() {
$(function () {
$.getJSON( "https://gdata.youtube.com/feeds/api/users/ElektraRecords/live/events?v=2&inline=true&alt=json-in-script&status=pending&orderby=published$callback=?",
function (data) {
$.each(data.feed.content.entry, function(i,entry) {
var videoid = 'http://www.youtube.com/embed/' + entry.yt$videoid.$t;
var title = '<h1>' + entry.media$title.$t + '</h1>';
var video = +title+ "<iframe width='420' height='315' src='"+videoid+ "' frameborder='0' allowfullscreen></iframe>";
$('#static_video').html(video);
});
});
});
});
</script>
</body>
</html>