{"_id":"@bytelucas/video-link-parser","name":"@bytelucas/video-link-parser","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bytelucas/video-link-parser","version":"1.0.0","description":"Get the YouTube, Vimeo, Vine, VideoPress, TikTok, Microsoft Stream, Loom or Dailymotion video id from a url or embed string.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/radiovisual/get-video-id.git"},"main":"dist/get-video-id.js","module":"dist/get-video-id.esm.js","types":"./index.d.ts","type":"commonjs","exports":{".":{"import":"./dist/get-video-id.esm.js","require":"./dist/get-video-id.js","types":"./index.d.ts"}},"author":{"name":"Byte Lucas","email":"lucasnguyenanh11@gmail.com","url":"https://www.npmjs.com/~bytelucas"},"engines":{"node":">=16"},"scripts":{"prebuild":"rimraf dist","test:post-build":"jest __tests__/builds/*","test":"npm run lint && c8 jest --runInBand --testPathIgnorePatterns='<rootDir>/__tests__/builds'","lint":"xo","lint:fix":"xo --fix","build":"rollup -c rollup.config.js && npm run test && npm run test:post-build","prepublish":"npm run build"},"keywords":["RegExp","regexp","iframe","embed","url","vine","vimeo","loom","youtube","videopress","microsoft stream","microsoft","dailymotion","tiktok","shorts","stream","from","string","id","video","read","retrieve","fetch","parse","extract","get"],"devDependencies":{"@babel/core":"^7.15.0","@babel/eslint-parser":"^7.12.1","@babel/plugin-transform-modules-commonjs":"^7.15.0","@babel/plugin-transform-runtime":"^7.23.9","@babel/preset-env":"^7.15.0","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","babel-eslint":"^10.1.0","babel-jest":"^27.1.0","c8":"^7.8.0","jest":"^27.1.0","jsdom":"^17.0.0","rimraf":"^3.0.0","rollup":"^4.5.1","rollup-plugin-preserve-directives":"^0.4.0","xo":"^0.56.0"},"xo":{"globals":["test","expect","describe"]},"c8":{"reporter":["text","lcov"]},"dependencies":{"@babel/runtime":"^7.23.9"},"private":false,"_id":"@bytelucas/video-link-parser@1.0.0","gitHead":"259b5865fcb1ec7d0ada7f02a668b082e717c41d","bugs":{"url":"https://github.com/radiovisual/get-video-id/issues"},"homepage":"https://github.com/radiovisual/get-video-id#readme","_nodeVersion":"20.11.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-1Ql3kaaX28qj2ELcyb0630RzsOYhTLR3ne1WBYbzzJyHLJmdBHm+gXqimUgxbIe1byAaSMb4C5h4AVsSjjDyig==","shasum":"4c69674af200f40c46055fd65ee47d5dea0762c2","tarball":"https://registry.npmjs.org/@bytelucas/video-link-parser/-/video-link-parser-1.0.0.tgz","fileCount":16,"unpackedSize":179184,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGsTfKnmVjahsWtne/WzXzlYr1v+CmBcikb4jnE75hE+AiEArc0ewryFzZgScGS1fzxWsODtIakxkkezlQienIMhIB8="}]},"_npmUser":{"name":"bytelucas","email":"lucasnguyenanh11@gmail.com"},"directories":{},"maintainers":[{"name":"bytelucas","email":"lucasnguyenanh11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/video-link-parser_1.0.0_1734883480159_0.4749419276221356"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-22T16:04:40.039Z","1.0.0":"2024-12-22T16:04:40.392Z","modified":"2024-12-22T16:04:40.716Z"},"maintainers":[{"name":"bytelucas","email":"lucasnguyenanh11@gmail.com"}],"description":"Get the YouTube, Vimeo, Vine, VideoPress, TikTok, Microsoft Stream, Loom or Dailymotion video id from a url or embed string.","homepage":"https://github.com/radiovisual/get-video-id#readme","keywords":["RegExp","regexp","iframe","embed","url","vine","vimeo","loom","youtube","videopress","microsoft stream","microsoft","dailymotion","tiktok","shorts","stream","from","string","id","video","read","retrieve","fetch","parse","extract","get"],"repository":{"type":"git","url":"git+https://github.com/radiovisual/get-video-id.git"},"author":{"name":"Byte Lucas","email":"lucasnguyenanh11@gmail.com","url":"https://www.npmjs.com/~bytelucas"},"bugs":{"url":"https://github.com/radiovisual/get-video-id/issues"},"license":"MIT","readme":"# get-video-id [![codecov](https://codecov.io/gh/radiovisual/get-video-id/branch/master/graph/badge.svg?token=fG7V2VRDYY)](https://codecov.io/gh/radiovisual/get-video-id)\n\n> Get the YouTube, Vimeo, Vine, VideoPress, TikTok, Microsoft Stream, Loom or Dailymotion video id from a url or embed string.\n\n**Pull Requests are welcome** if you would like to see support for other video services or if you find an unsupported video url pattern.\n\n## Install\n\nYou can install with npm:\n\n```\n$ npm install --save get-video-id\n```\n\nor with yarn:\n\n```\n$ yarn add get-video-id\n```\n\n## Import\n\nYou can use this module in **Node.js** or in the **browser**. See below for the different importing options.\n\n**CommonJS**\n```js\nconst getVideoId = require('get-video-id');\n```\n\n**ES Module**\n```js\nimport getVideoId from 'get-video-id';\n```\n\n**Browser**\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/get-video-id/dist/get-video-id.umd.min.js\"></script>\n```\n\n###### Download\n\n- [Normal](https://cdn.jsdelivr.net/npm/get-video-id/dist/get-video-id.js)\n- [Minified](https://cdn.jsdelivr.net/npm/get-video-id/dist/get-video-id.min.js)\n\n###### CDN\n\n- [jsdelivr](https://www.jsdelivr.com/package/npm/get-video-id)\n- [unpkg](https://unpkg.com/get-video-id)\n\n\n## Usage\n\nSimply supply the module with a url or embed string matching any of the [patterns known by this module](https://github.com/radiovisual/get-video-id#patterns) and its metadata of `id` and `service` will be returned:\n\n```js\nimport getVideoId from 'get-video-id';\n\ngetVideoId('https://www.youtube.com/watch?v=dQw4w9WgXcQ');\n//=> { id: 'dQw4w9WgXcQ', service: 'youtube' }\n\nconst { id } = getVideoId('https://www.youtube.com/watch?v=dQw4w9WgXcQ');\n//=> 'dQw4w9WgXcQ'\n```\n\nget-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.\n\n```js\ngetVideoId('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');\n//=> { id: 'dQw4w9WgXcQ', service: 'youtube' }\n```\n\n## API\n\n### getVideoId(input)\n\nReturns a metadata `Object` with the video `id` and `service` name:\n\n```\n{\n  id: `String` | `undefined`,\n  service: `String` | `undefined`\n}\n```\n\n#### input\n\nType: `String`\n\nThe url (or embed code, or google redirect url) from which you want to find the video id. See the\n[Patterns section](https://github.com/radiovisual/get-video-id#patterns) to see the formats that can be supplied.\n\n## Patterns\n\nThis module works on the url / embed patterns below.\n(where `*` is the id and `?` or `&` are parameter strings):\n\n### YouTube\n\n**YouTube Shortcodes**\n```\nhttp://youtu.be/*?\nhttps://youtu.be/*\nhttp://youtu.be/*\nhttp://y2u.be/*\nyoutube://\n```\n\n**YouTube Shorts**\n```\nhttps://youtube.com/shorts/*\nhttps://www.youtube.com/shorts/*\n```\n\n**YouTube `/v/` or `/vi/`**\n```\nhttp://www.youtube.com/v/*\nhttp://youtube.com/vi/*?\nhttp://youtube.com/v/*?\n```\n\n**YouTube `v=` or `vi=`**\n```\nhttp://www.youtube.com/ytscreeningroom?v=*\nhttp://www.youtube.com/watch?v=*?&\nhttps://www.youtube.com/watch?v=*\nhttp://youtube.com/watch?vi=*&\nhttp://youtube.com/?vi=*&\nhttp://youtube.com/?v=*\n```\n\n**YouTube `/e/`**\n```\nhttps://www.youtube.com/e/*\nhttps://www.youtube.com/e/*?\nhttp://www.youtube.com/e/*\nhttp://www.youtube.com/e/*?\n```\n\n**YouTube image links `/vi/*/` or `/an_webp/*/`**\n```\nhttps://i.ytimg.com/vi/*/hqdefault.jpg\nhttps://i.ytimg.com/an_webp/MYDcdp-VNmQ/mqdefault_6s.webp\n```\n\n**YouTube embed**\n```\nhttp://www.youtube.com/embed/*?\nhttps://www.youtube.com/embed/*\n```\n\n**YouTube user**\n```\nhttp://www.youtube.com/user/username#p/a/u/2/*\nhttp://www.youtube.com/user/username#p/u/1/*?\nhttp://www.youtube.com/user/username#p/u/1/*\n```\n\n**YouTube iframe**\n```\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/*\" frameborder=\"0\" allowfullscreen></iframe>\n```\n\n**YouTube `-nocookie`**\n```\nwww.youtube-nocookie.com/embed/*?\n```\n\n**YouTube Attribution Link**\n```\nhttp://www.youtube.com/attribution_link?u=%2Fwatch%3Fv%3D*%26\nhttp://www.youtube.com/attribution_link?u=%2Fwatch%3Fv%3D\nhttp://www.youtube.com/attribution_link?u=/watch?v=*&\nhttp://www.youtube.com/attribution_link?u=/watch?v=*\nhttp://www.youtube.com/attribution_link?/watch?v=*\n```\n\n**YouTube live URLs**\n```\nhttps://www.youtube.com/live/*\nhttps://youtube.com/live/*\nhttps://youtube.com/live/*?\n```\n\n**Google Redirection to YouTube**\n\n```\nhttps://google.cz/url?source=web&url=<YOUTUBE_URL>\nhttps://google.com/image?url=<YOUTUBE_URL>\n```\n\n### Vimeo\n\n**Vimeo urls**\n```\nhttps://vimeo.com/*\nhttps://vimeo.com/*?\nhttps://player.vimeo.com/video/*\nhttps://player.vimeo.com/video/*?\nhttps://www.vimeo.com/*\nhttps://www.vimeo.com/*?\n```\n\n**Vimeo swf embed**\n```\nhttp://vimeo.com/foo.swf?clip_id=1234\n```\n\n**Vimeo events**\n```\nhttps://vimeo.com/event/*\n```\n\n**Vimeo iframe**\n```\n<iframe src=\"https://player.vimeo.com/video/*\" ...\n```\n\n**Vimeo unlisted/private urls**\n```\nhttps://vimeo.com/*/privateHash\n```\n⚠️ **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.\n\n### Vine\n\n**Vine urls**\n```\nhttps://vine.co/v/*\n```\n\n**Vine iframe**\n```\n<iframe src=\"https://vine.co/v/*/embed/simple\" width=\"600\" height=\"600\" frameborder=\"0\"></iframe>\n<iframe src=\"https://vine.co/v/*/embed/postcard\" width=\"600\" height=\"600\" frameborder=\"0\"></iframe>\n```\n\n### VideoPress\n\n**VideoPress urls**\n```\nhttps://videopress.com/v/*\nhttps://videopress.com/embed/*\n```\n\n**VideoPress iframes**\n```\n<iframe src=\"https://videopress.com/embed/zcnJVzQF\" width=\"600\" height=\"600\"></iframe>\n```\n\n### Microsoft Stream\n\n**Microsoft Stream urls**\n```\nhttps://web.microsoftstream.com/video/*\nhttps://web.microsoftstream.com/embed/video/*\n```\n\n**Microsoft Stream iframes**\n```\n<iframe src=\"https://web.microsoftstream.com/embed/video/*?&\" width=\"640\" height=\"360\"></iframe>\n```\n\n### TikTok\n\n**TikTok urls**\n```\nhttps://www.tiktok.com/*/video/*\nhttps://www.tiktok.com/*/video/*?\n````\n**:warning: Unsupported TikTok urls**\n *  Shortlink URL (requires a fetch/redirect to find the real id) : `https://vm.tiktok.com/shorLinkId/`\n\n### Dailymotion\n\n**Dailymotion urls**\n```\nhttp://www.dailymotion.com/video/*_text\nhttp://www.dailymotion.com/video/*\nhttp://www.dailymotion.com/fr/relevance/search/search+query/1#video=*\nhttps://www.dailymotion.com/video/*?playlist=\nhttp://dai.ly/*\n```\n\n**Dailymotion iframes**\n```\n<iframe src=\"https://www.dailymotion.com/embed/video/*\" width=\"600\" height=\"600\"></iframe>\n```\n\n**:warning: Unsupported Dailymotion urls**\n *  Channel id urls: `http://www.dailymotion.com/hub/*_title`\n\n### Loom\n\n**Loom urls**\n```\nhttps://www.loom.com/share/*\nhttps://www.loom.com/share/*?\nhttps://www.loom.com/embed/*\n ```\n\n**Loom iframes**\n```\n<iframe src=\"https://www.loom.com/embed/*\" width=\"600\" height=\"600\"></iframe>\n```\n\n## Contributing\n\nIf you discover a url pattern that is not covered by this module, please [open an issue](https://github.com/radiovisual/get-video-id/issues) to report it, or [submit a Pull Request](https://github.com/radiovisual/get-video-id/pull/new/master). For any submitted pull requests, please ensure that you include unit test(s) to fully cover your code contribution(s).\n\n## License\n\nMIT © [Michael Wuergler](https://github.com/radiovisual)\n","readmeFilename":"readme.md"}