I found a method on the Internet that can get youtube video id from url.
here it is.
var vid;
var results;
results = url.match ("[\\? &] v = ([^] *)");
vid = (results === null)? url: results [1];
The identifier will be contained in "vid".
What I do not understand, and I find it interesting and want to know this.
results = url.match ("[\\? &] v = ([^] *)");
How it works?
source
share