I want to get the v=id from YouTube’s URL with JavaScript (no jQuery, pure JavaScript).
v=id
http://www.youtube.c
I have summed up all the suggestions and here is the universal and short answer to this question:
if(url.match('http://(www.)?youtube|youtu\.be')){ youtube_id=url.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0]; }