Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

youtube-regex

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtube-regex - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

5

history.md

@@ -0,1 +1,6 @@

## v1.0.5 / November 18, 2015
- resolve #3 - trailing slash after `watch` (e.g. youtube.com/watch/?v=v2ifWcnQs6M)
## v1.0.4 / December 15, 2014

@@ -2,0 +7,0 @@ - moved to [regexps org][regexps-url]

4

index.js

@@ -10,6 +10,6 @@ /**

module.exports = function youtubeRegex() {
var regex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/g;
module.exports = function youtubeRegex() {
var regex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\/?\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/g;
return regex;
};
{
"name": "youtube-regex",
"description": "The correct Youtube video id regex! Regex done right!",
"version": "1.0.4",
"version": "1.0.5",
"scripts": {

@@ -6,0 +6,0 @@ "test": "npm install && node_modules/.bin/mocha",

@@ -62,2 +62,27 @@ /**

'youtube.com/attribution_link?u=/e/watch?feature=related&v=0EWbonj7f18'
],
// trailing slash
trailing: [
'youtube.com/user/sandervandoorntv/watch/?v=WijF8aivOo8',
'youtube.com/user/sandervandoorntv/watch/?v=WijF8aivOo8&feature=related',
'youtube.com/user/sandervandoorntv/watch/?feature=related&v=WijF8aivOo8',
'youtube.com/watch/?v=0EWbonj7f18',
'youtube.com/watch/?feature=related&v=0EWbonj7f18',
'youtube.com/watch/?v=0EWbonj7f18&feature=related',
'youtube.com/embed/watch/?v=0EWbonj7f18',
'youtube.com/embed/watch/?feature=related&v=0EWbonj7f18',
'youtube.com/e/watch/?v=0EWbonj7f18',
'youtube.com/e/watch/?feature=related&v=0EWbonj7f18',
'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?v=WijF8aivOo8',
'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?v=WijF8aivOo8&feature=related',
'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?feature=related&v=WijF8aivOo8',
'youtube.com/attribution_link?u=/watch/?v=0EWbonj7f18',
'youtube.com/attribution_link?u=/watch/?feature=related&v=0EWbonj7f18',
'youtube.com/attribution_link?u=/watch/?v=0EWbonj7f18&feature=related',
'youtube.com/attribution_link?u=/embed/watch/?v=0EWbonj7f18',
'youtube.com/attribution_link?u=/embed/watch/?feature=related&v=0EWbonj7f18',
'youtube.com/attribution_link?u=/embed/v/0EWbonj7f18',
'youtube.com/attribution_link?u=/e/v/0EWbonj7f18',
'youtube.com/attribution_link?u=/e/watch/?v=0EWbonj7f18',
'youtube.com/attribution_link?u=/e/watch/?feature=related&v=0EWbonj7f18'
]

@@ -86,2 +111,8 @@ };

});
it('trailing slash (watch/?v=id) links', function(done) {
fixtures.trailing.forEach(function each(link) {
assert.ok(test(link));
});
done();
});
});

@@ -88,0 +119,0 @@ describe('should NOT match id from', function() {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc