jquery - 在网页上显示youtube json供稿

标签 jquery html json youtube

我想使用YouTube提供的JSON Feed以特定方式显示我的YouTube播放列表视频。但是,我很难在网页上设置其格式。有人可以帮忙吗?

这是YouTube JSON供稿:
https://gdata.youtube.com/feeds/api/playlists/jXVuxJfLPGPP-lUw5Es--O7y4XkK7G1o?v=2&alt=json

  • (我可以在最后一个URL的末尾添加“c”,并获得该供稿的其他版本)
  • (如果我摘掉“&v = 2&alt = json”,它是XML版本)
  • (我也使用FeedBurner将其也转换为RSS feed)
    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或类似thisthis的示例?我希望这有帮助。快乐的编码:)

    关于jquery - 在网页上显示youtube json供稿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18026401/

    相关文章:

    javascript - 视频高清按钮,js播放器

    javascript - 在 while 循环中从一种表单发布数据

    html - 导航栏不透明度问题

    json - Spring Boot - 在 URI 处读取 CSV 文件并将其作为 JSON 返回

    json - 如何更改 native 响应中获取响应的按钮文本?

    Javascript 将电话号码填充到 3 个输入文本框中,名称相同但没有 id

    javascript - 下拉列表中选定的值不会清除 jQuery

    javascript - 使用 x 关闭或隐藏信息框

    html - 购物车 - 购物车 CSS 中的商品数量

    ios - AFNetworking:getPath:参数方法导致问题