How to get a youtube playlist using javascript API and json?

IMHO, you code can be much shortened if you use $. GetJSON $. Each Try this.

Up vote 1 down vote favorite 3 share g+ share fb share tw.

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.entryi. Link1.

Href; When I do this in single line not in cikle evrithing is ok but in cikle for or while I have error. //get youtube ID function extract(url){ pos1=url. IndexOf("videos/"); pos2=url.

Substr(42,11); return pos2; } //My playlist LINK var url2="gdata.youtube.com/feeds/api/playlists/B2...; function playlistinfo(url1) { $. Ajax({ url: url1, dataType: "jsonp", success: function (data) { parseresults(data); } }); } //whit this get playlist data function parseresults(data) { //return playlist clip number var klipove= data.feed. OpenSearch$totalResults.

$t; //put clips in for(i=0;i'). AppendTo('. Cont'); } } javascript jquery json youtube jsonp link|improve this question edited Jul 3 '11 at 3:05naveen10.1k42059 asked Jul 3 '11 at 0:16plamen107 100% accept rate.

3 I really have no idea what you are saying. You should try and clean up your post. – james Jul 3 '11 at 0:22 Indeed, please reformat your code and double check what should be formatted as code / where line breaks should be.

– kwah Jul 3 '11 at 0:33 What is data? – Mike Samuel Jul 3 '11 at 2:10 @plamen -- how did you fix this for OPERA? – Lacy Jul 3 '11 at 18:18 @Lacy see my demo link deathdreamer.atwebpages.com/proba19.php All javascript code is in this page.

Open whit firebug and see what you need :) uts very old and messy code but is good for starting :) – plamen Jul 3 '11 at 1:20.

IMHO, you code can be much shortened if you use $. GetJSON, $. Each Try this.

Var playListURL = 'gdata.youtube.com/feeds/api/playlists/B2...; var videoURL= '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. Link1.

Href; var fragments = feedURL. Split("/"); var videoID = fragmentsfragments. Length - 2; var url = videoURL + videoID; var thumb = "http://img.youtube.com/vi/"+ videoID +"/default.

Jpg"; 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 ).

Tnx :) I try 1 weeek to fix this line :) you help me very much :) – plamen Jul 3 '11 at 8:37 @plamen: you could mark as answer if your issue is solved. – naveen Jul 3 '11 at 9:29 tnx ... for first time I write here and I didn't know :) tnx alot :) – plamen Jul 3 '11 at 9:54 no probs. I also had a first time here:) – naveen Jul 3 '11 at 10:02 I have litle problem ...this function not work in internet explorer and opera... onli MOZILLA .... can you help me?

– plamen Jul 3 '117 at 20:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions