// to accomodate the new short URL format
function getVideoId(url){
if(url.indexOf('?') != -1 ) {
var query = decodeURI(url).split('?')[1];
var params = query.split('&');
for(var i=0,l = params.length;i
return params[i].replace('v=','');
} else if (url.indexOf('youtu.be') != -1) {
return decodeURI(url).split('youtu.be/')[1];
}
return null;
}
var urlOLD = "http://www.youtube.com/watch?v=UF8uR6Z6KLc&feature=feedlik";
var urlNEW = "http://youtu.be/UF8uR6Z6KLc";
trace(getVideoId(urlOLD));
trace(getVideoId(urlNEW));
No comments:
Post a Comment