This article walks you through how to get the ID of any YouTube video.
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
.
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
.
The easiest method is to use the "Stats for nerds" option.
- Right click the embedded video player to present a menu.
- Select the "Stats for nerds" option in the menu.
- Note the "Video ID" property.
Feel free to test on this video player in the following link: http://codepen.io/anon/pen/qReQZL
I'm not sure in what context you're asking this in but, if you're making a music discord bot and just so happen to use the lavaplayer library, use
AudioTrack.getIdentifier();
basicallyAudioTrack
is the currently playing track whileidentifier
is obviously the identifier. But if you're using other libraries/asking this question to do something else than to make a music discord bot, I'm not sure how to help. I hope this helps you and/or other people who are searching for the answer. :D