youtube-url

0.5.0 • Public • Published

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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i youtube-url

    Weekly Downloads

    375

    Version

    0.5.0

    License

    MIT

    Last publish

    Collaborators

    • ellell
    • iefserge
    • kesla