Skip to content

Instantly share code, notes, and snippets.

@TastyToast
Created August 14, 2013 16:09
Show Gist options
  • Save TastyToast/6232578 to your computer and use it in GitHub Desktop.
Save TastyToast/6232578 to your computer and use it in GitHub Desktop.
Youtube Video Id Parser
<script type="text/javascript">
function youtube_parser(url){
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(regExp);
if (match&&match[7].length==11){
return match[7];
}else{
alert("Url incorrecta");
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment