This is part of my youtube project. I try to extract video information from JSON format but I have problem in this line:
var videoId = data.feed.entry[i].li
IMHO, you code can be much shortened if you use $.getJSON, $.each
Try this.
var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/B2A4E1367126848D?v=2&alt=json&callback=?';
var videoURL= 'http://www.youtube.com/watch?v=';
$.getJSON(playListURL, function(data) {
var list_data="";
$.each(data.feed.entry, function(i, item) {
var feedTitle = item.title.$t;
var feedURL = item.link[1].href;
var fragments = feedURL.split("/");
var videoID = fragments[fragments.length - 2];
var url = videoURL + videoID;
var thumb = "http://img.youtube.com/vi/"+ videoID +"/default.jpg";
if (videoID !='videos') {
list_data += '
';
}
});
$(list_data).appendTo(".cont");
});
Demo: Fiddle for the playlist you have provided
P.S: Keep in mind that thumbnail for a youtube video could be found at
http://img.youtube.com/vi/{video-id}/default.jpg
( More Info here )