{"id":15440723,"url":"https://github.com/alanshaw/embed-video","last_synced_at":"2025-04-09T09:07:59.046Z","repository":{"id":16587537,"uuid":"19341841","full_name":"alanshaw/embed-video","owner":"alanshaw","description":"🎥 Get embed HTML code for youtube/vimeo/whatever from URL or ID","archived":false,"fork":false,"pushed_at":"2023-05-08T03:55:01.000Z","size":130,"stargazers_count":72,"open_issues_count":7,"forks_count":27,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-02T06:07:40.095Z","etag":null,"topics":["embed","html","iframe","screenshot","share","thumbnails","video","vimeo","youtube"],"latest_commit_sha":null,"homepage":"http://npm.im/embed-video","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alanshaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-01T10:33:12.000Z","updated_at":"2024-11-18T00:59:52.000Z","dependencies_parsed_at":"2024-06-18T14:04:45.771Z","dependency_job_id":"818285d3-f02e-45a1-89ea-831c0b5999a8","html_url":"https://github.com/alanshaw/embed-video","commit_stats":{"total_commits":56,"total_committers":9,"mean_commits":6.222222222222222,"dds":0.5892857142857143,"last_synced_commit":"7cfbc28aab170191d1f57a9716a59b761b1f71f6"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fembed-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fembed-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fembed-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanshaw%2Fembed-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanshaw","download_url":"https://codeload.github.com/alanshaw/embed-video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embed","html","iframe","screenshot","share","thumbnails","video","vimeo","youtube"],"created_at":"2024-10-01T19:15:09.287Z","updated_at":"2025-04-09T09:07:59.025Z","avatar_url":"https://github.com/alanshaw.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# embed-video\n\n[![Build Status](http://img.shields.io/travis/alanshaw/embed-video.svg)](https://travis-ci.org/alanshaw/embed-video) [![devDependency Status](https://david-dm.org/alanshaw/embed-video/dev-status.svg)](https://david-dm.org/alanshaw/embed-video#info=devDependencies) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\u003e Get embed code for embedding youtube/vimeo/dailymotion/whatever video in websites from URL or ID.\n\nCurrently supports YouTube, Vimeo and DailyMotion. Please pull request to add others!\n\n## Example\n\n```js\nvar embed = require(\"embed-video\")\n\nvar vimeoUrl = \"http://vimeo.com/19339941\"\nvar youtubeUrl = \"https://www.youtube.com/watch?v=twE64AuqE9A\"\nvar dailymotionUrl = \"https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport\"\n\nconsole.log(embed(vimeoUrl))\nconsole.log(embed(youtubeUrl))\nconsole.log(embed(dailymotionUrl))\n\nvar vimeoId = \"6964150\"\nvar youtubeId = \"9XeNNqeHVDw\"\nvar dailymotionId = \"x20qnej\"\n\nconsole.log(embed.vimeo(vimeoId))\nconsole.log(embed.youtube(youtubeId))\nconsole.log(embed.dailymotion(dailymotionId))\n```\n\nOutput:\n\n```html\n\u003ciframe src=\"//player.vimeo.com/video/19339941\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen\u003e\u003c/iframe\u003e\n\u003ciframe src=\"//www.youtube.com/embed/twE64AuqE9A\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003ciframe src=\"//www.dailymotion.com/embed/video/x20qnej\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003ciframe src=\"//player.vimeo.com/video/6964150\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen\u003e\u003c/iframe\u003e\n\u003ciframe src=\"//www.youtube.com/embed/9XeNNqeHVDw\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003ciframe src=\"//www.dailymotion.com/embed/video/x20qnej\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e\n```\n\n## Usage\n\n```js\nvar embed = require(\"embed-video\")\n```\n\n### embed(url, [options])\n\nReturn an HTML fragment embed code (string) for the given video URL. Returns `undefined` if unrecognised.\n\n### embed.image(url, [options], callback)\n\nReturns an HTML `\u003cimg\u003e` tag (string) for the given url and the `src` in a callback. Works for **youtube**, **vimeo** and **dailymotion**. Returns `undefined` if unrecognised.\n\n```js\n{\n  src: http://img.youtube.com/vi/eob7V_WtAVg/default.jpg,\n  html: \u003cimg src=\"http://img.youtube.com/vi/eob7V_WtAVg/default.jpg\"/\u003e\n}\n```\n\n### embed.info(url)\n\nReturns 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.\n\n```js\n{\n  id: String,\n  url: String,\n  source: Enum \"youtube\", \"vimeo\", \"dailymotion\"\n}\n```\n\n## Options\n\n### `query`\n\nObject to be serialized as a querystring and appended to the embedded content url.\n\n\n#### Example\n\n```js\nconsole.log(embed.vimeo(\"19339941\", {query: {portrait: 0, color: '333'}}))\n```\n\nOutput:\n\n```html\n\u003ciframe src=\"//player.vimeo.com/video/19339941?portrait=0\u0026color=333\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen\u003e\u003c/iframe\u003e\n```\n### `attr`\n\nObject to add additional attributes (any) to the iframe\n\n#### Example\n\n```js\nconsole.log(embed('https://youtu.be/jglUWD3KMh4', {query: {portrait: 0, color: '333'}, attr:{width:400, height:200}}))\n```\n\nOutput:\n```html\n\u003ciframe src=\"//www.youtube.com/embed/jglUWD3KMh4?portrait=0\u0026color=333\" frameborder=\"0\" allowfullscreen width=\"400\" height=\"200\"\u003e\u003c/iframe\u003e\n```\n\n### `image`\n\n#### Youtube Image options\n\n|option|image|\n|:------|:-----:|\n|default|![](http://img.youtube.com/vi/eob7V_WtAVg/default.jpg)|\n|mqdefault|![](http://img.youtube.com/vi/eob7V_WtAVg/mqdefault.jpg)|\n|hqdefault|![](http://img.youtube.com/vi/eob7V_WtAVg/hqdefault.jpg)|\n|sddefault|![](http://img.youtube.com/vi/eob7V_WtAVg/sddefault.jpg)|\n|maxresdefault|![](http://img.youtube.com/vi/eob7V_WtAVg/maxresdefault.jpg)|\n\n```js\nembedVideo.image('https://www.youtube.com/watch?v=ekETjYMo6QE', {image: 'mqdefault'}, function (err, thumbnail) {\n  if (err) throw err\n  console.log(thumbnail.src)\n  // https://img.youtube.com/vi/ekETjYMo6QE/mqdefault.jpg\n  console.log(thumbnail.html)\n  // \u003cimg src=\"https://img.youtube.com/vi/ekETjYMo6QE/mqdefault.jpg\"/\u003e  \n})\n```\n\n#### Vimeo Image options\n\n|option|image|\n|:---|:---|\n|thumbnail_small|![](http://i.vimeocdn.com/video/122513613_100x75.jpg)|\n|thumbnail_medium|![](http://i.vimeocdn.com/video/122513613_200x150.jpg)|\n|thumbnail_large|![](http://i.vimeocdn.com/video/122513613_640.jpg)|\n\n```js\nembedVideo.image('https://vimeo.com/19339941', {image: 'thumbnail_medium'}, function (err, thumbnail) {\n  if (err) throw err\n  console.log(thumbnail.src)\n  // http://i.vimeocdn.com/video/122513613_200x150.jpg\n  console.log(thumbnail.html)\n  // \u003cimg src=\"http://i.vimeocdn.com/video/122513613_200x150.jpg\"/\u003e\n})\n```\n\n#### DailyMotion Image options\n\n|option|image|\n|:---|:---|\n|thumbnail_60_url|![](http://s1.dmcdn.net/IgPVQ/x60-oZg.jpg)|\n|thumbnail_120_url|![](http://s1.dmcdn.net/IgPVQ/x120-llF.jpg)|\n|thumbnail_180_url|![](http://s1.dmcdn.net/IgPVQ/x180-DpY.jpg)|\n|thumbnail_240_url|![](http://s1.dmcdn.net/IgPVQ/x240-JCj.jpg)|\n|thumbnail_360_url|![](http://s1.dmcdn.net/IgPVQ/x360-s-z.jpg)|\n|thumbnail_480_url|![](http://s1.dmcdn.net/IgPVQ/x480-ktj.jpg)|\n|thumbnail_720_url|![](http://s1.dmcdn.net/IgPVQ/x720-d_h.jpg)|\n|thumbnail_1080_url|![](http://s1.dmcdn.net/IgPVQ/x1080-HsJ.jpg)|\n\n```js\nembedVideo.image('https://www.dailymotion.com/video/x20qnej_red-bull-presents-wild-ride-bmx-mtb-dirt_sport', {image: 'thumbnail_720_url'}, function (err, thumbnail) {\n  if (err) throw err\n  console.log(thumbnail.src)\n  // http://s1.dmcdn.net/IgPVQ/x720-d_h.jpg\n  console.log(thumbnail.html)\n  // \u003cimg src=\"http://s1.dmcdn.net/IgPVQ/x720-d_h.jpg\"/\u003e\n})\n```\n\n## Contribute\n\nFeel free to dive in! [Open an issue](https://github.com/alanshaw/embed-video/issues/new) or submit PRs.\n\n## License\n\n[MIT](LICENSE) © Alan Shaw\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanshaw%2Fembed-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanshaw%2Fembed-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanshaw%2Fembed-video/lists"}