Giter VIP home page Giter VIP logo

youtube-regex's Introduction

youtube-regex NPM version Build Status Coveralls regexps org

The correct Youtube video id regex. Regex done right!

Install Nodei.co stats

Install with npm

$ npm install youtube-regex
$ npm test

Online

Usage

var youtubeRegex = require('youtube-regex');

// contains youtube url address
youtubeRegex().test('unicorn youtube.com/watch?v=0EWbonj7f18');
//=> true

// also these will works
youtubeRegex().test('youtube.com/watch?v=0EWbonj7f18');
//=> true
youtubeRegex().test('youtube.com/watch?feature=related&v=0EWbonj7f18');
//=> true
youtubeRegex().test('youtube.com/watch?v=0EWbonj7f18&feature=related');
//=> true
youtubeRegex().test('http://www.youtube.com/watch?v=0EWbonj7f18');
//=> true
youtubeRegex().test('http://www.youtube.com/watch?feature=related&v=0EWbonj7f18');
//=> true

For more use-cases see tests

Authors & Contributors

Charlike Mike Reagent author tips

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT license.

youtube-regex's People

Contributors

greenkeeper[bot] avatar sindresorhus avatar tunnckocore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

youtube-regex's Issues

Some youtube/tv links not working

Trying to get in touch regarding a security issue

Hey there!

I'd like to report a security issue but cannot find contact instructions on your repository.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

Youtube URL pattern with trailing slash

Hello,

It seems like this URL with a trailing slash after watch is a valid Youtube URL.
https://www.youtube.com/watch/?v=v2ifWcnQs6M

I haven't seen it offered officially by Youtube, but some of our users submitted links (that failed) with such slash.

Is is something you could support?
Anyway thank you for offering this module.

Cheers

Support Youtube thumbnail URLs

Is there a way we can have it so this module supports Youtube thumbnail URLs? Here is a relevant Stackoverflow question.

Ideally the regex would support URLs such as

https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg

Along with the other quality thumbnails.

Global flag

I tried, just for curiosity, against this URL https://www.youtube.com/watch?v=_T2Dxgn-lls in a normal Firefox browser with normal .match and it wouldn't work unless removing the g flag. After removing it the regex returned the id in the array as needed. Is this the wanted behaviour?

Why return a function?

Possibly missing something, but it seems to me like:

module.exports = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\/?\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/g;

Would be a better solution and let you get the benefits of Node module caching. Is there a reason you don't use it?

demo

cuz dont like these online regex tools 💃

Is this repository maintained?

There are half decades old issues and no recent activity. Most recent issues seem like it needs some response but none are present. Do you need help or?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.