Ok so I am trying to change my script for getting youtube playlist to the uploaded videos from youtube instead, reason I am changing this is because I want to use the username not an id (e.x. 38484937495 to this instead MrEasyBB)
So here is my first script which works but it is a playlist and don't want that anymore...
var width= 780;
var height= 420;
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 pubed = item.published.$t;
var thumb = "http://img.youtube.com/vi/"+ videoID +"/default.jpg";
list_data += '<li class="video_info" value="'+ url +'"><img alt="'+ feedTitle+'" src="'+ thumb +'"/><span class="title">'+ feedTitle +'</span><span class="pubed">'+ pubed +'</span></li>';
});
$(list_data).appendTo("#playlist");
});
I have started with this and it is not much
var width= 780;
var height= 420;
var username = "MrEasyBB";
var playListURL = 'https://gdata.youtube.com/feeds/api/users/'+ username +'/uploads?v=2&alt=jsonc';
var videoURL= 'http://www.youtube.com/embed/';
$.getJSON(playListURL, function(data){
var list_data="";
$.each(function(i, item) {
var title = item.data.items[0].title;
var description = item.data.items[0].description;
var pubbd = item.data.items[0].uploaded;
var videoID = item.data.items[0].id;
var url = videoURL + videoID;
var thumb = "http://img.youtube.com/vi/"+ videoID +"/default.jpg";
list_data += '<li class="video_info" value="'+ url +'"><img alt="'+ feedTitle+'" src="'+ thumb +'"/><span class="title">'+ feedTitle +'</span><span class="pubed">'+ pubed +'</span></li>';
});
$(list_data).appendTo("#playlist");
});
As you can see I haven't gotten very far to the second code because once I change the var playListURL
to the json c link it won't work to me. I tried changing the var in the each... Maybe I should get rid of the .each? Not sure really. Can someone point me in the right direction?