Skip to content

Instantly share code, notes, and snippets.

@bitwhys
Created March 2, 2021 16:40
Show Gist options
  • Save bitwhys/962e73fa04baf49ce33700f0f55d1950 to your computer and use it in GitHub Desktop.
Save bitwhys/962e73fa04baf49ce33700f0f55d1950 to your computer and use it in GitHub Desktop.

Revisions

  1. bitwhys created this gist Mar 2, 2021.
    6 changes: 6 additions & 0 deletions get_YT_VideoID
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    const getVideoId = url => {
    const videoIDRegEx = new RegExp(/v=(\S{11})/)
    const matches = url.match(videoIDRegEx)
    const [_, video_id] = matches
    return video_id
    }