我正在嘗試使用YouTube API v2.0 - Retrieving Live Events 來吸引最近的YouTube直播活動Feed但我的腳本似乎並不奏效。這是我的代碼。嵌入YouTube Live Feed
<!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>
這與v3的API改變。 Dupe在這裏:[我可以使用YouTube的LiveStreaming API訪問所有現場直播?](http://stackoverflow.com/questions/33380083/can-i-access-all-live-broadcasts-with-youtubes-livestreaming-api) – JAL