我是否需要开发人员的密钥才能在我的网站中使用 oembed for youtube?
问题是以下代码不起作用,它不会返回成功
$.ajax({
url: "http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=PVzljDmoPVs",
dataType: "jsonp",
timeout: 15000,
success: function (jo) {
if (jo) {
setIMg(jo.thumbnail_url);
setTitle(jo.title);
}
}
});
但是当我在浏览器中触发 url 时,它给了我 json:
{"provider_url": "http:\/\/www.youtube.com\/", "thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/PVzljDmoPVs\/hqdefault.jpg", "title": "David Guetta - She Wolf (Falling To Pieces) ft. Sia", "html": "\u003ciframe width=\"480\" height=\"270\" src=\"http:\/\/www.youtube.com\/embed\/PVzljDmoPVs?fs=1\u0026feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e", "author_name": "davidguettavevo", "height": 270, "thumbnail_width": 480, "width": 480, "version": "1.0", "author_url": "http:\/\/www.youtube.com\/user\/davidguettavevo", "provider_name": "YouTube", "type": "video", "thumbnail_height": 360}