Gathering detailed insights and metrics for embed-video
Gathering detailed insights and metrics for embed-video
Gathering detailed insights and metrics for embed-video
Gathering detailed insights and metrics for embed-video
🎥 Get embed HTML code for youtube/vimeo/whatever from URL or ID
npm install embed-video
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
73 Stars
65 Commits
27 Forks
9 Watchers
1 Branches
7 Contributors
Updated on Apr 14, 2025
Latest Version
2.0.4
Package Id
embed-video@2.0.4
Unpacked Size
22.07 kB
Size
5.23 kB
File Count
6
NPM Version
5.6.0
Node Version
9.10.0
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
3
Get embed code for embedding youtube/vimeo/dailymotion/whatever video in websites from URL or ID.
Currently supports YouTube, Vimeo and DailyMotion. Please pull request to add others!
1var embed = require("embed-video") 2 3var vimeoUrl = "http://vimeo.com/19339941" 4var youtubeUrl = "https://www.youtube.com/watch?v=twE64AuqE9A" 5var dailymotionUrl = "https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport" 6 7console.log(embed(vimeoUrl)) 8console.log(embed(youtubeUrl)) 9console.log(embed(dailymotionUrl)) 10 11var vimeoId = "6964150" 12var youtubeId = "9XeNNqeHVDw" 13var dailymotionId = "x20qnej" 14 15console.log(embed.vimeo(vimeoId)) 16console.log(embed.youtube(youtubeId)) 17console.log(embed.dailymotion(dailymotionId))
Output:
1<iframe src="//player.vimeo.com/video/19339941" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 2<iframe src="//www.youtube.com/embed/twE64AuqE9A" frameborder="0" allowfullscreen></iframe> 3<iframe src="//www.dailymotion.com/embed/video/x20qnej" frameborder="0" allowfullscreen></iframe> 4<iframe src="//player.vimeo.com/video/6964150" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 5<iframe src="//www.youtube.com/embed/9XeNNqeHVDw" frameborder="0" allowfullscreen></iframe> 6<iframe src="//www.dailymotion.com/embed/video/x20qnej" frameborder="0" allowfullscreen></iframe>
1var embed = require("embed-video")
Return an HTML fragment embed code (string) for the given video URL. Returns undefined
if unrecognised.
Returns an HTML <img>
tag (string) for the given url and the src
in a callback. Works for youtube, vimeo and dailymotion. Returns undefined
if unrecognised.
1{ 2 src: http://img.youtube.com/vi/eob7V_WtAVg/default.jpg, 3 html: <img src="http://img.youtube.com/vi/eob7V_WtAVg/default.jpg"/> 4}
Returns an object
containing the video ID, video source ("youtube"
, "vimeo"
, "dailymotion"
), and the original url. Works for youtube, vimeo and dailymotion. Returns undefined
if unrecognised.
1{ 2 id: String, 3 url: String, 4 source: Enum "youtube", "vimeo", "dailymotion" 5}
query
Object to be serialized as a querystring and appended to the embedded content url.
1console.log(embed.vimeo("19339941", {query: {portrait: 0, color: '333'}}))
Output:
1<iframe src="//player.vimeo.com/video/19339941?portrait=0&color=333" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
attr
Object to add additional attributes (any) to the iframe
1console.log(embed('https://youtu.be/jglUWD3KMh4', {query: {portrait: 0, color: '333'}, attr:{width:400, height:200}}))
Output:
1<iframe src="//www.youtube.com/embed/jglUWD3KMh4?portrait=0&color=333" frameborder="0" allowfullscreen width="400" height="200"></iframe>
image
option | image |
---|---|
default | ![]() |
mqdefault | ![]() |
hqdefault | ![]() |
sddefault | ![]() |
maxresdefault | ![]() |
1embedVideo.image('https://www.youtube.com/watch?v=ekETjYMo6QE', {image: 'mqdefault'}, function (err, thumbnail) { 2 if (err) throw err 3 console.log(thumbnail.src) 4 // https://img.youtube.com/vi/ekETjYMo6QE/mqdefault.jpg 5 console.log(thumbnail.html) 6 // <img src="https://img.youtube.com/vi/ekETjYMo6QE/mqdefault.jpg"/> 7})
option | image |
---|---|
thumbnail_small | ![]() |
thumbnail_medium | ![]() |
thumbnail_large | ![]() |
1embedVideo.image('https://vimeo.com/19339941', {image: 'thumbnail_medium'}, function (err, thumbnail) { 2 if (err) throw err 3 console.log(thumbnail.src) 4 // http://i.vimeocdn.com/video/122513613_200x150.jpg 5 console.log(thumbnail.html) 6 // <img src="http://i.vimeocdn.com/video/122513613_200x150.jpg"/> 7})
option | image |
---|---|
thumbnail_60_url | ![]() |
thumbnail_120_url | ![]() |
thumbnail_180_url | ![]() |
thumbnail_240_url | ![]() |
thumbnail_360_url | ![]() |
thumbnail_480_url | ![]() |
thumbnail_720_url | ![]() |
thumbnail_1080_url | ![]() |
1embedVideo.image('https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport', {image: 'thumbnail_720_url'}, function (err, thumbnail) { 2 if (err) throw err 3 console.log(thumbnail.src) 4 // http://s1.dmcdn.net/IgPVQ/x720-d_h.jpg 5 console.log(thumbnail.html) 6 // <img src="http://s1.dmcdn.net/IgPVQ/x720-d_h.jpg"/> 7})
Feel free to dive in! Open an issue or submit PRs.
MIT © Alan Shaw
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/19 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
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