ytdl-core
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -236,2 +236,5 @@ var qs = require('querystring'); | ||
} | ||
if (!idRegex.test(id)) { | ||
throw new Error('Video id (' + id + ') does not match expected format (' + idRegex.toString() + ')'); | ||
} | ||
return id; | ||
@@ -238,0 +241,0 @@ }; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"repository": { | ||
@@ -12,0 +12,0 @@ "type": "git", |
@@ -96,3 +96,3 @@ var assert = require('assert-diff'); | ||
describe('from a non-existant video', function() { | ||
var id = 'not-found'; | ||
var id = 'unknown-vid'; | ||
var url = VIDEO_BASE + id; | ||
@@ -99,0 +99,0 @@ |
@@ -225,12 +225,18 @@ var util = require('../lib/util'); | ||
var id; | ||
id = util.getVideoID('http://www.youtube.com/watch?v=VIDEO_ID'); | ||
assert(id, 'VIDEO_ID'); | ||
id = util.getVideoID('http://youtu.be/VIDEO_ID'); | ||
assert(id, 'VIDEO_ID'); | ||
id = util.getVideoID('http://youtube.com/v/VIDEO_ID'); | ||
assert(id, 'VIDEO_ID'); | ||
id = util.getVideoID('http://youtube.com/embed/VIDEO_ID'); | ||
assert(id, 'VIDEO_ID'); | ||
id = util.getVideoID('http://www.youtube.com/watch?v=RAW_VIDEOID'); | ||
assert(id, 'RAW_VIDEOID'); | ||
id = util.getVideoID('http://youtu.be/RAW_VIDEOID'); | ||
assert(id, 'RAW_VIDEOID'); | ||
id = util.getVideoID('http://youtube.com/v/RAW_VIDEOID'); | ||
assert(id, 'RAW_VIDEOID'); | ||
id = util.getVideoID('http://youtube.com/embed/RAW_VIDEOID'); | ||
assert(id, 'RAW_VIDEOID'); | ||
id = util.getVideoID('RAW_VIDEOID'); // Video ids are 11-character long | ||
assert(id, 'RAW_VIDEOID'); | ||
assert.throws(function () { | ||
util.getVideoID('www.youtube.com'); | ||
}, Error, 'No video id found: www.youtube.com'); | ||
assert.throws(function () { | ||
util.getVideoID('www.youtube.com/playlist?list=1337'); | ||
}, Error, 'Video id (playlist) does not match expected format (/^[a-zA-Z0-9-_]{11}$/)'); | ||
}); | ||
@@ -237,0 +243,0 @@ }); |
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
15004283
80442