amobiz / youtube-url

YouTube url tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SYNOPSIS

YouTube URL tools

Build Status

USAGE

var youtubeUrl = require('youtube-url');

FUNCTIONS

youtubeUrl.valid

Validate YouTube URL

youtubeUrl.valid('https://www.youtube.com/watch?v=YoB8t0B4jx4');   // true
youtubeUrl.valid('https://www.other-url.com/watch?v=YoB8t0B4jx4'); // false

// works with youtu.be URLs too
youtubeUrl.valid('http://youtu.be/vzM3nApSvMg'); // true

youtubeUrl.extractId

Extract the video ID from a YouTube URL

youtubeUrl.extractId('https://www.youtube.com/watch?v=YoB8t0B4jx4');
// returns YoB8t0B4jx4

youtubeUrl.extractId('https://www.other-url.com/watch?v=YoB8t0B4jx4');
// returns false

##LICENSE

MIT

About

YouTube url tools


Languages

Language:JavaScript 100.0%