【问题标题】:Youtube jquery get video page htmlYoutube jquery获取视频页面html
【发布时间】:2013-12-20 09:09:35
【问题描述】:

嗨,我只想简单地从 youtube 获取一个 url 并代表 html 内容.. 我的代码现在看起来像这样:

$.ajax({url: "http://www.youtube.com/watch?v=VIDEOID",
                type: 'get',
                dataType:'jsonp',
                crossDomain:true,
                success: function(data,text,xhqr){
                    console.log(data);
                }
            });

结果是:

Resource interpreted as Script but transferred with MIME type text/html: "http://www.youtube.com/watch?v=rr5EyyhSU_k&callback=jQuery110209012887296266854_1387530192875&_=1387530192876". jquery.js:8516 Uncaught SyntaxError: Unexpected token < 

我没有数据...有人可以帮助我吗? :)

【问题讨论】:

    标签: javascript php jquery html youtube


    【解决方案1】:

    试试这个,

        $.ajax({             
          url: 'http://query.yahooapis.com/v1/ public/yql',                 
          data: {q: "select * from json where url ='http://www.youtube.com/oembed?url=http:// www.youtube.com/watch? v=wbp-3BJWsU8&format=json'",format: "json" },  
          dataType: "jsonp",
          success: function (data) {  
               alert(JSON.stringify(data));
          },             
          error: function (result) {
                 alert("Sorry no data found.");
          }         
        });
    

    【讨论】:

    猜你喜欢
    • 2015-08-09
    • 1970-01-01
    • 2021-09-07
    • 2019-08-23
    • 2016-12-13
    • 2013-04-04
    • 2011-07-22
    • 2011-07-08
    • 2011-06-13
    相关资源
    最近更新 更多