get-youtube-id

Parse a youtube url returning the video ID.

MIT 6 个版本
安装
npm install get-youtube-id
yarn add get-youtube-id
pnpm add get-youtube-id
bun add get-youtube-id
README

get-youtube-id

Parse a youtube url returning the video ID.

Installation

npm install get-youtube-id

Example

var getYouTubeID = require('get-youtube-id');

var id = getYouTubeID("http://www.youtube.com/watch?v=9bZkp7q19f0");
console.log(id); // "9bZkp7q19f0"


// Or, if you're using ES6 syntax:
import getYouTubeID from 'get-youtube-id';

Fuzzy matching

By default getYouTubeID will make a last-ditch effort to look for anything that resembles an 11-character id. If you want it to be more strict you can turn this off with an options argument.

var getYouTubeID = require('get-youtube-id');

var id = getYouTubeID("youtube abcdefghijk", {fuzzy: false});
console.log(id); // null

License

MIT

版本列表
1.0.1 2019-01-24
1.0.0 2015-08-20
0.1.3 2013-03-14
0.1.2 2013-03-13
0.1.1 2013-03-11
0.1.0 2013-03-11