Skip to content

Instantly share code, notes, and snippets.

@cassidoo
Created January 6, 2023 20:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cassidoo/c9e2987dc0fd12491b31f5cb57630f00 to your computer and use it in GitHub Desktop.
Save cassidoo/c9e2987dc0fd12491b31f5cb57630f00 to your computer and use it in GitHub Desktop.
Get YouTube ID with JavaScript
let url = "https://www.youtube.com/watch?v=nVvxOwxuk_w";
url = url.split("v=")[1].split("&")[0]; // this removes out any extra parameters, like a playlist point etc
console.log(url);
// id = nVvxOwxuk_w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment