0
我想弄清楚如何使用jquery獲取Youtube視頻的所有信息,並且只取得了一點成功。如何使用jquery獲取Youtube視頻信息
我用下面的代碼來獲取視頻標題和描述...
var url = "http://gdata.youtube.com/feeds/api/videos?q=" + id + "&max-results=1&v=2&alt=jsonc";
var title;
$.getJSON(url,
function(response)
{
title = response.data.items[0].title;
description = response.data.items[0].description;
author = response.data.items[0].name;
$('#details-title').text("Title: " + title);
$('#details-desc').text("Description: " + description);
}
);
我怎麼會想出什麼其他的領域可以用這種方法來獲得?例如,我試圖獲得上傳者姓名和視頻長度。
'console.log(response)'並檢查可用的數據,或者轉到api文檔。 – 2013-04-11 19:20:30