This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support non-youtube (speificially vimeo) videos. fixes #39
- Loading branch information
Showing
2 changed files
with
49 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,52 @@ | ||
var vows = require('vows'); | ||
var ytdl = require('..'); | ||
var assert = require('assert'); | ||
var video = 'http://www.youtube.com/watch?v=90AiXO1pAiA'; | ||
|
||
|
||
var expected = { | ||
title: 'lol', | ||
id: '90AiXO1pAiA', | ||
thumbnail: 'https://i1.ytimg.com/vi/90AiXO1pAiA/hqdefault.jpg', | ||
description: 'Ridley High School\'s real American Bad ASS,A true Delco Savage. Filmed in 2003 before Youtube was invented. This is also the original I find it hilarious that there are copycat videos!', | ||
filename: 'lol-90AiXO1pAiA.mp4', | ||
itag: '18', | ||
resolution: '640x360' | ||
}; | ||
|
||
vows.describe('getInfo').addBatch({ | ||
'from a video': { | ||
'from a youtube video': { | ||
'topic': function() { | ||
var video = 'http://www.youtube.com/watch?v=90AiXO1pAiA'; | ||
ytdl.getInfo(video, ['-f', '18/22/37/38'], this.callback); | ||
}, | ||
|
||
'info returned': function(err, info) { | ||
assert.isNull(err); | ||
assert.isObject(info); | ||
assert.equal(info.id, expected.id); | ||
assert.equal(info.itag, expected.itag); | ||
assert.equal(info.title, expected.title); | ||
assert.equal(info.id, '90AiXO1pAiA'); | ||
assert.equal(info.itag, '18'); | ||
assert.equal(info.title, 'lol'); | ||
assert.isString(info.url); | ||
assert.isString(info.thumbnail); | ||
assert.equal(info.description, | ||
'Ridley High School\'s real American Bad ASS,A true Delco Savage. ' + | ||
'Filmed in 2003 before Youtube was invented. ' + | ||
'This is also the original I find it hilarious that there ' + | ||
'are copycat videos!'); | ||
assert.equal(info.filename, 'lol-90AiXO1pAiA.mp4'); | ||
assert.equal(info.resolution, '640x360'); | ||
} | ||
}, | ||
'from a vimeo video': { | ||
'topic': function() { | ||
var video = 'https://vimeo.com/6586873'; | ||
ytdl.getInfo(video, this.callback); | ||
}, | ||
|
||
'info returned': function(err, info) { | ||
assert.isNull(err); | ||
assert.isObject(info); | ||
assert.equal(info.id, '6586873'); | ||
assert.equal(info.title, 'OWEN - good friends, bad habits'); | ||
assert.isString(info.url); | ||
assert.isString(info.thumbnail); | ||
assert.equal(info.description, expected.description); | ||
assert.equal(info.filename, expected.filename); | ||
assert.equal(info.resolution, expected.resolution); | ||
assert.equal(info.description, | ||
'Video for the song "Good Friends, Bad Habits" from the album ' + | ||
'New Leaves. Directed by Joe Wigdahl. Purchase the album here: ' + | ||
'hobbledehoyrecords.com/store'); | ||
assert.equal(info.filename, | ||
'OWEN - good friends, bad habits-6586873.mp4'); | ||
assert.equal(info.resolution, '480x272'); | ||
} | ||
} | ||
}).export(module); |