Skip to content

Instantly share code, notes, and snippets.

@jakebellacera
Last active May 21, 2024 06:40
Show Gist options
  • Save jakebellacera/d81bbf12b99448188f183141e6696817 to your computer and use it in GitHub Desktop.
Save jakebellacera/d81bbf12b99448188f183141e6696817 to your computer and use it in GitHub Desktop.
Learn how to get the ID of any YouTube video.

How to get the ID of any YouTube Video

This article walks you through how to get the ID of any YouTube video.

How to get a YouTube video ID from a youtube.com page URL

You may be watching the video or just happened to visit a link to a video. The video ID will be located in the URL of the video page, right after the v= URL parameter.

In this case, the URL of the video is: https://www.youtube.com/watch?v=aqz-KE-bpKQ. Therefore, the ID of the video is aqz-KE-bpKQ.

How to get a YouTube video ID from a youtu.be short URL

The youtu.be URLs are created by generating a URL intendend for sharing. They differ slightly from youtube.com URLs because there are no URL parameters. Instead, the video ID is part of the URL itself.

In this case, the URL of the video is: https://youtu.be/aqz-KE-bpKQ. Therefore, the ID of the video is aqz-KE-bpKQ.

How to get a YouTube video ID from an embedded video player

The easiest method is to use the "Stats for nerds" option.

  1. Right click the embedded video player to present a menu.
  2. Select the "Stats for nerds" option in the menu.
  3. Note the "Video ID" property.

Feel free to test on this video player in the following link: http://codepen.io/anon/pen/qReQZL

@Whygal
Copy link

Whygal commented Mar 13, 2023

How can I get a list of ids, from a channel, without api key?

@delanyoyoko
Copy link

How about shorts?

@JAYAMURUGANJ
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment