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

Dhw*_*nit 6 jquery jsonp oembed

我正在使用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);
});
Run Code Online (Sandbox Code Playgroud)

任何人遇到oembed jsonp请求的类似问题?

pol*_*lau 0

Youtube\xe2\x80\x99s Oembed API 目前不会\xe2\x80\x99t 将 JSON 响应包装在回调中。JSONP 根本不支持 atm,而且似乎这不会很快改变\xe2\x80\x99:\n https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata /5KuXxlLK07g

\n\n

这里\xe2\x80\x99是相关功能请求的票证:https://code.google.com/p/gdata-issues/issues/detail ?id=4329

\n\n

最简单的解决方案是实现一个小型服务器端代理来代表 client\xe2\x80\x99s 发出请求。

\n