Gathering detailed insights and metrics for get-video-id
Gathering detailed insights and metrics for get-video-id
Gathering detailed insights and metrics for get-video-id
Gathering detailed insights and metrics for get-video-id
get-youtube-id
Parse a youtube url returning the video ID.
embed-video
Get embed code for embedding youtube/vimeo/whatever video in websites from URL or ID
@shelf/get-video-id
Wrapper around https://github.com/radiovisual/get-video-id to return youtube start from query params
@gonetone/get-youtube-id-by-url
Get YouTube channel or video id by url!
Get the YouTube, Vimeo, Vine, VideoPress, TikTok, Microsoft Stream, Loom or Dailymotion video id from a url or embed string.
npm install get-video-id
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (98.26%)
HTML (1.74%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
199 Stars
264 Commits
25 Forks
6 Watchers
3 Branches
18 Contributors
Updated on Jun 04, 2025
Latest Version
4.1.7
Package Id
get-video-id@4.1.7
Unpacked Size
174.94 kB
Size
23.18 kB
File Count
16
NPM Version
10.7.0
Node Version
20.14.0
Published on
Jun 24, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
18
Get the YouTube, Vimeo, Vine, VideoPress, TikTok, Microsoft Stream, Loom or Dailymotion video id from a url or embed string.
Pull Requests are welcome if you would like to see support for other video services or if you find an unsupported video url pattern.
You can install with npm:
$ npm install --save get-video-id
or with yarn:
$ yarn add get-video-id
You can use this module in Node.js or in the browser. See below for the different importing options.
CommonJS
1const getVideoId = require('get-video-id');
ES Module
1import getVideoId from 'get-video-id';
Browser
1<script src="https://cdn.jsdelivr.net/npm/get-video-id/dist/get-video-id.umd.min.js"></script>
Simply supply the module with a url or embed string matching any of the patterns known by this module and its metadata of id
and service
will be returned:
1import getVideoId from 'get-video-id';
2
3getVideoId('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
4//=> { id: 'dQw4w9WgXcQ', service: 'youtube' }
5
6const { id } = getVideoId('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
7//=> 'dQw4w9WgXcQ'
get-video-id can also find the video buried in a Google redirection URL if it contains a reference to any of the supported URL patterns.
1getVideoId('https://www.google.cz/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwj30L2MvpDVAhUFZVAKHb8CBaYQuAIIIjAA&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ');
2//=> { id: 'dQw4w9WgXcQ', service: 'youtube' }
Returns a metadata Object
with the video id
and service
name:
{
id: `String` | `undefined`,
service: `String` | `undefined`
}
Type: String
The url (or embed code, or google redirect url) from which you want to find the video id. See the Patterns section to see the formats that can be supplied.
This module works on the url / embed patterns below.
(where *
is the id and ?
or &
are parameter strings):
YouTube Shortcodes
http://youtu.be/*?
https://youtu.be/*
http://youtu.be/*
http://y2u.be/*
youtube://
YouTube Shorts
https://youtube.com/shorts/*
https://www.youtube.com/shorts/*
YouTube /v/
or /vi/
http://www.youtube.com/v/*
http://youtube.com/vi/*?
http://youtube.com/v/*?
YouTube v=
or vi=
http://www.youtube.com/ytscreeningroom?v=*
http://www.youtube.com/watch?v=*?&
https://www.youtube.com/watch?v=*
http://youtube.com/watch?vi=*&
http://youtube.com/?vi=*&
http://youtube.com/?v=*
YouTube /e/
https://www.youtube.com/e/*
https://www.youtube.com/e/*?
http://www.youtube.com/e/*
http://www.youtube.com/e/*?
YouTube image links /vi/*/
or /an_webp/*/
https://i.ytimg.com/vi/*/hqdefault.jpg
https://i.ytimg.com/an_webp/MYDcdp-VNmQ/mqdefault_6s.webp
YouTube embed
http://www.youtube.com/embed/*?
https://www.youtube.com/embed/*
YouTube user
http://www.youtube.com/user/username#p/a/u/2/*
http://www.youtube.com/user/username#p/u/1/*?
http://www.youtube.com/user/username#p/u/1/*
YouTube iframe
<iframe width="560" height="315" src="https://www.youtube.com/embed/*" frameborder="0" allowfullscreen></iframe>
YouTube -nocookie
www.youtube-nocookie.com/embed/*?
YouTube Attribution Link
http://www.youtube.com/attribution_link?u=%2Fwatch%3Fv%3D*%26
http://www.youtube.com/attribution_link?u=%2Fwatch%3Fv%3D
http://www.youtube.com/attribution_link?u=/watch?v=*&
http://www.youtube.com/attribution_link?u=/watch?v=*
http://www.youtube.com/attribution_link?/watch?v=*
YouTube live URLs
https://www.youtube.com/live/*
https://youtube.com/live/*
https://youtube.com/live/*?
Google Redirection to YouTube
https://google.cz/url?source=web&url=<YOUTUBE_URL>
https://google.com/image?url=<YOUTUBE_URL>
Vimeo urls
https://vimeo.com/*
https://vimeo.com/*?
https://player.vimeo.com/video/*
https://player.vimeo.com/video/*?
https://www.vimeo.com/*
https://www.vimeo.com/*?
Vimeo swf embed
http://vimeo.com/foo.swf?clip_id=1234
Vimeo events
https://vimeo.com/event/*
Vimeo iframe
<iframe src="https://player.vimeo.com/video/*" ...
Vimeo unlisted/private urls
https://vimeo.com/*/privateHash
⚠️ Please note: That get-video-id
will extract the id from the private/unlisted URLs formats for Vimeo, but the private hash would still be required to rebuild the URL in order to make it reachable/sharable in a browser. If you use get-video-id
to help you rebuild URLs, you will want to look for this pattern yourself and remember to include the privateHash in the url you want to share. get-video-id
focuses on extracing video ids, and ignores any other special paramaters or formats at the moment.
Vine urls
https://vine.co/v/*
Vine iframe
<iframe src="https://vine.co/v/*/embed/simple" width="600" height="600" frameborder="0"></iframe>
<iframe src="https://vine.co/v/*/embed/postcard" width="600" height="600" frameborder="0"></iframe>
VideoPress urls
https://videopress.com/v/*
https://videopress.com/embed/*
VideoPress iframes
<iframe src="https://videopress.com/embed/zcnJVzQF" width="600" height="600"></iframe>
Microsoft Stream urls
https://web.microsoftstream.com/video/*
https://web.microsoftstream.com/embed/video/*
Microsoft Stream iframes
<iframe src="https://web.microsoftstream.com/embed/video/*?&" width="640" height="360"></iframe>
TikTok urls
https://www.tiktok.com/*/video/*
https://www.tiktok.com/*/video/*?
:warning: Unsupported TikTok urls
https://vm.tiktok.com/shorLinkId/
Dailymotion urls
http://www.dailymotion.com/video/*_text
http://www.dailymotion.com/video/*
http://www.dailymotion.com/fr/relevance/search/search+query/1#video=*
https://www.dailymotion.com/video/*?playlist=
http://dai.ly/*
Dailymotion iframes
<iframe src="https://www.dailymotion.com/embed/video/*" width="600" height="600"></iframe>
:warning: Unsupported Dailymotion urls
http://www.dailymotion.com/hub/*_title
Loom urls
https://www.loom.com/share/*
https://www.loom.com/share/*?
https://www.loom.com/embed/*
Loom iframes
<iframe src="https://www.loom.com/embed/*" width="600" height="600"></iframe>
If you discover a url pattern that is not covered by this module, please open an issue to report it, or submit a Pull Request. For any submitted pull requests, please ensure that you include unit test(s) to fully cover your code contribution(s).
MIT © Michael Wuergler
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
7 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/12 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More