我想使用YouTube提供的JSON Feed以特定方式显示我的YouTube播放列表视频。但是,我很难在网页上设置其格式。有人可以帮忙吗?
这是YouTube JSON供稿:
https://gdata.youtube.com/feeds/api/playlists/jXVuxJfLPGPP-lUw5Es--O7y4XkK7G1o?v=2&alt=json
http://feeds.feedburner.com/dclatestsermons?format=rss
我必须将其放在网页的正文中,因为我正在使用Weebly。我的页面上现在有类似的内容,效果很好。它使用与另一个网站不同的JSON feed。
这是代码:
<html>
<body>
<!-- I have to put it in the body, which is why I was leaning towards JSON -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">$(document).ready(function()
{ $.ajax(
{url: 'https://destinychurch.smartevents.com/public/events.jsonp',
dataType: 'jsonp',success: function(eventfeed)
{var eventsforhome = "<table>";
for (i=0;i<4;i++) {
eventsforhome += "<tr><td><a href=" + eventfeed[i].url +
"><img src=" + eventfeed[i].logo_cropped_url +
"></a></td></tr>"; }
eventsforhome += ("</table>");
$('#events').append(eventsforhome); }});});
</script>
<div id=events></div>
</body>
</html>
我尝试使用相同的代码,换出了提要URL,换出了变量,然后没有任何效果。
如果有人知道如何使用这些供稿中的任何一种来在网页正文中格式化YouTube视频,将不胜感激。谢谢!
最佳答案
您是否 checkout 了documentation或类似this或this的示例?我希望这有帮助。快乐的编码:)
关于jquery - 在网页上显示youtube json供稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18026401/