Asked 7 years ago
4 Jan 2017
Views 1453
Phpworker

Phpworker posted

get video id from YouTube video url at JavaScript

how to get video id form YouTube video URL in JavaScript . may be by JavaScript Regex or any other way .


https://www.youtube.com/watch?v=3AtDnEC4zak



it should work with any format of url but return video id . so i can use it with other server call
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

you can split url as string with keyword "v=" and you get video id .


 var url="https://www.youtube.com/watch?v=3AtDnEC4zak"
 console.log(url.split("v=")[1]);

Post Answer