Tag: oembed

用ajax获取youtube oembed json

我试着用ajax获取youtube链接的oembed代码,但它总是返回错误我正在使用带有Jquery的ajax $.ajax({ method: ‘GET’, dataType :’json’, url:’http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=wbp-3BJWsU8&format=json’, success:function(data){ alert(data); }, error: function(error) { alert(error); } });

使用oembed嵌入YouTubevideo

我想使用oembed从youtube链接获取jQuery的嵌入代码: var url = “http://www.youtube.com/watch?v=iwGFalTRHDA”; url = encodeURIComponent(url); $.getJSON(‘http://youtube.com/oembed?url=’+url+’&format=json’, function(data) { console.log(data); }); 好吧,我没有得到任何数据。 有趣的是,如果我浏览到url,我会得到正确的答案: http://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DiwGFalTRHDA&format=json` 引导我去 { provider_url: “http://www.youtube.com/” title: “Trololo” html: “” author_name: “KamoKatt” height: 344 thumbnail_width: 480 width: 425 version: “1.0” author_url: “http://www.youtube.com/user/KamoKatt” provider_name: “YouTube” thumbnail_url: “http://sofzh.miximages.com/javascript/hqdefault.jpg” type: “video” thumbnail_height: 360 } 我还使用了jquery oembed插件,但是如果请求成功,也会抛出onError选项。 我真的很期待一些想法……

对youtube oembed调用的JSONp请求的响应给出“无效标签”错误

我正在使用oembed对youtube进行JSONp调用,并且响应firebug会出现“invalid label”错误 这是我的代码 site = “www.youtube.com”; url = “http://www.youtube.com/watch?v=slORb622ZI8”; $.getJSON(“http://”+site+”/oembed?callback=?”,{“format”:”json”,”url”:url},function(data){ alert(“hello:\n”+data); alert(data.provider_url); }); 任何人遇到oembed jsonp请求的类似问题?