youtube-regex
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -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] |
@@ -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", |
31
test.js
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13878
131