youtube playlist link retreiver

type in a youtube playlist link, and this will get all links to videos in the playlist.

HTML

Enter youtube playlist url: <input type="text" id="youtubeUrl" value="https://www.youtube.com/playlist?list=PLpclVninnGnu9a9qQphjPsK95kkZsNS_z" /> | 
<button id="startButton">start</button><br>
<textarea id="results" cols="50" rows="200"></textarea>

JavaScript

$('#startButton').click(function(){
		$('#results').val('');
		var youtubeUrl = $('#youtubeUrl').val();
		var fromListOnwards = youtubeUrl.substring(youtubeUrl.indexOf('list=')).split('&');
		var playlistID = fromListOnwards[0].substring(5);
		var resultsPerPage=50;
		var index=1;
		var absoluteMax=999;
		var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/'+playlistID+'?alt=json&v=2&max-results='+resultsPerPage+'&start-index='+index+'&callback=?';
		var videoURL= 'http://www.youtube.com/watch?v=';
		var keepGoing = true;
		while(keepGoing&&index<absoluteMax){
			$.getJSON(playListURL, {}).done(function(data) {
				var list_data="";
				if (data.feed.entry.length<resultsPerPage){
					keepGoing=false;
				}
				$.each(data.feed.entry, function(i, item) {
					var feedURL = item.link[1].href;
					var fragments = feedURL.split("/");
					var videoID = fragments[fragments.length - 2];
					var url = videoURL + videoID;
					list_data += url + '\n';
				});
				var results = $('#results').val();
				$('#results').val(results+=list_data);
				//$(list_data).appendTo(".cont");
			});
			index+=resultsPerPage;
			playListURL = 'http://gdata.youtube.com/feeds/api/playlists/PLpclVninnGnu9a9qQphjPsK95kkZsNS_z?alt=json&v=2&max-results='+resultsPerPage+'&start-index='+index+'&callback=?';
		}
	});