Given an YouTube video URL of the form - Node.js String

Node.js examples for String:URL String

Description

Given an YouTube video URL of the form

Demo Code


//    http://www.youtube.com/watch?v=hRp3ND-fBNw&feature=youtube_gdata,
//  extract the ID i.e. hRp3ND-fBNw

extractVideoID = function(url) {
    var pos = url.indexOf('=');

    return url.substring(pos + 1, pos + 1 + 11);
}

Related Tutorials