I want to get the v=id from YouTube’s URL with JavaScript (no jQuery, pure JavaScript).
v=id
http://www.youtube.c
This can get video id from any type of youtube links
var url= 'http://youtu.be/0zM3nApSvMg'; var urlsplit= url.split(/^.*(youtu.be\/|v\/|embed\/|watch\?|youtube.com\/user\/[^#]*#([^\/]*?\/)*)\??v?=?([^#\&\?]*).*/); console.log(urlsplit[3]);