In this topics I will discus about "How to get YouTube video id from its URL". For this create a simple javascript function as bellow -
function YouTubeGetID(url){ | |
var ID = ''; | |
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); | |
if(url[2] !== undefined) { | |
ID = url[2].split(/[^0-9a-z_\-]/i); | |
ID = ID[0]; | |
} | |
else { | |
ID = url; | |
} | |
return ID; | |
} |
var youtubeurl="https://www.youtube.com/watch?v=_Yt9Xfo4VN4"; | |
YouTubeGetID(youtubeurl); |
_Yt9Xfo4VN4 |
Now it's time for enjoy.
For any comment or suggestion on this topics, please mention your comment on comment box bellow.
Its a wonderful post and very helpful, thanks for all this information.
ReplyDeleteJavascript Course
Thank you for sharing nice blog
ReplyDeletee accounting course in uttam nagar
Thank you for sharing nice blog
ReplyDeletePrivate School in Pali