Socket
Socket
Sign inDemoInstall

youtube-validator

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    youtube-validator

checks validity of youtube urls and ids


Version published
Maintainers
1
Install size
68.8 kB
Created

Readme

Source

##youtube-validator

nodejs module that validates wether a given url or id are valid youtube videos or not


####how to install npm install youtube-validator

####what is valid and invalid url/id?

  • valid url/id are all strings that do match with an existent youtube video url or id, depending on the function called. ex:
var validUrl1 = 'youtube.com/watch?v=2XH5_qafR8k' 
var validUrl2 = 'www.youtube.com/watch?v=2XH5_qafR8k' 
var validUrl3 = 'http://www.youtube.com/watch?v=2XH5_qafR8k' 
var validUrl4 = 'www.YOUTUBE.COM/watch?v=2XH5_qafR8k' 
var validID = '2XH5_qafR8k' 
  • invalid url/id are the same as above, but on the other waya around. ex:
var invalidUrl1 = 'random_stuff_here' 
var invalidUrl2 = 'www.youtube.com/' 
var invalidUrl3 = 'www.youtube.com' 
var invalidUrl44 = 'www.youtube.com/watch?v=2XH5_qafR8k'.toUpperCase() //video ids are case sensitive 
var invalidID = 'id_that_does_not_exist'  

###how to use

var validator = require('youtube-validator')
//..
validator.validateUrl(url, function(res, err) {
  if(err) //err
  else
    //res == url
})`
//...

validator.validateVideoID(id, function(res, err) {
  if(err) //err
  else
    //res == url
})

Keywords

FAQs

Last updated on 25 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc