Get YouTube channel or video id by url!
Please report any bugs you discover at https://github.com/GoneToneStudio/node-get-youtube-id-by-url/issues
Node.js 12.0.0 or newer is required.
npm install @gonetone/get-youtube-id-by-url
yarn add @gonetone/get-youtube-id-by-url
ES Module (ESM)
import { channelId, videoId } from '@gonetone/get-youtube-id-by-url';
CommonJS (CJS)
const { channelId, videoId } = require('@gonetone/get-youtube-id-by-url');
channelId('YouTube Channel Url').then((id) => {
console.log(id);
});
Support URL format:
- https://www.youtube.com/channel/xxxxxxxxxxxxxxxxxxxxxxxx
- https://www.youtube.com/c/xxxxxxxx
- https://www.youtube.com/user/xxxxxxxx
videoId('YouTube Video Url').then((id) => {
console.log(id);
});
Support URL format: