youtube-comment-api
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -7,2 +7,6 @@ var _ = require('lodash') | ||
console.error('WARNING: This module is deprecated. Please see https://github.com/philbot9/youtube-comment-api#deprecated for details. Pull requests welcome.') | ||
module.exports = function (userConfig) { | ||
@@ -9,0 +13,0 @@ userConfig = userConfig || {} |
{ | ||
"name": "youtube-comment-api", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Youtube comment API", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"request-promise": "^0.4.3", | ||
"youtube-info": "^1.1.0" | ||
"youtube-info": "^1.1.1" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
@@ -5,2 +5,8 @@ # Youtube Comment API | ||
## DEPRECATED!!! | ||
YouTube has made some changes to the way comments are handled. Therefore, this module no longer works. I have written an alternative module that uses Tasks to handle async operations [youtube-comments-task](https://github.com/philbot9/youtube-comments-task). | ||
It should be relatively easy to fix this module, but I don't have the time at the moment. **Pull requests are of course welcome.** | ||
## Purpose | ||
@@ -7,0 +13,0 @@ |
@@ -18,3 +18,3 @@ var expect = require('chai').expect | ||
it('should give an error for an invalid video ID', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchCommentsPage('fakeID', null).then(function (page) { | ||
@@ -28,3 +28,3 @@ expect(page).not.to.exist | ||
it('should get a comments page without a page token', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchCommentsPage('eKEwL-10s7E', null).then(function (page) { | ||
@@ -41,3 +41,3 @@ expect(page).to.have.a.property('html') | ||
it('should get a different comments page with a page token', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchCommentsPage('eKEwL-10s7E', null).then(function (page1) { | ||
@@ -55,3 +55,3 @@ fetchCommentsPage('eKEwL-10s7E', page1.nextPageToken).then(function (page2) { | ||
it('should return valid HTML for comments', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchCommentsPage('eKEwL-10s7E', null).then(function (page) { | ||
@@ -63,4 +63,4 @@ var $ = cheerio.load(page.html) | ||
it("should return different videos' comments", function () { | ||
this.timeout(60000) | ||
it('should return different videos\' comments', function () { | ||
this.timeout(180000) | ||
return fetchCommentsPage('eKEwL-10s7E', null).then(function (page1) { | ||
@@ -67,0 +67,0 @@ expect(page1.html).to.exist |
@@ -17,3 +17,3 @@ var expect = require('chai').expect | ||
it('should give an error for an invalid video ID', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return getCommentsPage('fakeID', null).then(function (page) { | ||
@@ -27,4 +27,4 @@ expect(page).not.to.exist | ||
it('should get a comments page without a page token', function () { | ||
this.timeout(60000) | ||
return getCommentsPage('pkwOrteyQtY', null).then(function (page) { | ||
this.timeout(180000) | ||
return getCommentsPage('BUCnjlTfXDw', null).then(function (page) { | ||
expect(page).to.have.a.property('comments').that.is.an('array') | ||
@@ -52,5 +52,5 @@ expect(page.comments).to.have.length.above(1) | ||
it('should get a different comments page with a page token', function () { | ||
this.timeout(60000) | ||
return getCommentsPage('pkwOrteyQtY', null).then(function (page1) { | ||
return getCommentsPage('pkwOrteyQtY', page1.nextPageToken).then(function (page2) { | ||
this.timeout(180000) | ||
return getCommentsPage('BUCnjlTfXDw', null).then(function (page1) { | ||
return getCommentsPage('BUCnjlTfXDw', page1.nextPageToken).then(function (page2) { | ||
expect(page1).to.not.deep.equal(page2) | ||
@@ -81,4 +81,4 @@ expect(page2).to.have.a.property('comments').that.is.an('array') | ||
it('should include video information', function () { | ||
this.timeout(60000) | ||
return getCommentsPage('pkwOrteyQtY', null).then(function (page) { | ||
this.timeout(180000) | ||
return getCommentsPage('BUCnjlTfXDw', null).then(function (page) { | ||
expect(page).to.exist | ||
@@ -85,0 +85,0 @@ expect(page).to.have.a.property('videoCommentCount').that.is.a('number') |
@@ -69,3 +69,2 @@ var expect = require('chai').expect | ||
}) | ||
}) |
@@ -25,3 +25,3 @@ var expect = require('chai').expect | ||
it('should give an error for an invalid video ID', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchReplies('fakeId', 'z13oy5eavyzketqp204cjvjadqu5xttiwhk').then(function (page) { | ||
@@ -35,3 +35,3 @@ expect(page).not.to.exist | ||
it('should give an error for an invalid comment ID', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchReplies('eKEwL-10s7E', 'yadayada').then(function (page) { | ||
@@ -45,3 +45,3 @@ expect(page).not.to.exist | ||
it('should get replies to a comment', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchReplies('eKEwL-10s7E', 'z13oy5eavyzketqp204cjvjadqu5xttiwhk').then(function (page) { | ||
@@ -55,3 +55,3 @@ expect(page).to.have.a.property('html') | ||
it('should return valid HTML for replies', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchReplies('eKEwL-10s7E', 'z13oy5eavyzketqp204cjvjadqu5xttiwhk').then(function (page) { | ||
@@ -58,0 +58,0 @@ var $ = cheerio.load(page.html) |
@@ -22,4 +22,4 @@ var expect = require('chai').expect | ||
it("function 'get' should send a GET request", function () { | ||
this.timeout(30000) | ||
it('function \'get\' should send a GET request', function () { | ||
this.timeout(180000) | ||
return request.get('https://www.youtube.com/all_comments?v=MfM7Y9Pcdzw').then(function (responseText) { | ||
@@ -31,4 +31,4 @@ expect(responseText).to.be.a('string') | ||
it("function 'get' should receive a cookie", function () { | ||
this.timeout(30000) | ||
it('function \'get\' should receive a cookie', function () { | ||
this.timeout(180000) | ||
return request.get('https://www.youtube.com/all_comments?v=MfM7Y9Pcdzw').then(function (res) { | ||
@@ -51,4 +51,4 @@ expect(request.CookieJar).to.have.a.property('_jar') | ||
it("function 'post' should send a POST request", function () { | ||
this.timeout(30000) | ||
it('function \'post\' should send a POST request', function () { | ||
this.timeout(180000) | ||
return getSessionToken('MfM7Y9Pcdzw').then(function (sessionToken) { | ||
@@ -55,0 +55,0 @@ return request.post('https://www.youtube.com/comment_ajax?action_load_comments=1&order_by_time=True&filter=MfM7Y9Pcdzw', { |
@@ -11,3 +11,3 @@ var expect = require('chai').expect | ||
it('should fetch the video info', function () { | ||
this.timeout(30000) | ||
this.timeout(180000) | ||
return fetchVideoInfo('eKEwL-10s7E').then(function (videoInfo) { | ||
@@ -14,0 +14,0 @@ expect(videoInfo).to.exist |
@@ -10,4 +10,4 @@ var expect = require('chai').expect | ||
it('should support callback functions', function (done) { | ||
this.timeout(60000) | ||
fetchCommentPage('pkwOrteyQtY', function (err, page) { | ||
this.timeout(180000) | ||
fetchCommentPage('BUCnjlTfXDw', function (err, page) { | ||
expect(err).not.to.exist | ||
@@ -23,3 +23,3 @@ expect(page).to.exist | ||
it('should return errors for callback functions', function (done) { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
fetchCommentPage('fakeID', function (err, page) { | ||
@@ -33,4 +33,4 @@ expect(err).to.exist | ||
it('should support promises', function () { | ||
this.timeout(60000) | ||
return fetchCommentPage('pkwOrteyQtY').then(function (page) { | ||
this.timeout(180000) | ||
return fetchCommentPage('BUCnjlTfXDw').then(function (page) { | ||
expect(page).to.exist | ||
@@ -40,7 +40,7 @@ expect(page).to.have.a.property('videoTitle').which.is.a('string') | ||
expect(page.comments).to.have.length.above(0) | ||
}) | ||
}) | ||
}); | ||
}); | ||
it('should return errors for promises', function () { | ||
this.timeout(60000) | ||
this.timeout(180000) | ||
return fetchCommentPage('fakeID').catch(function (err) { | ||
@@ -59,4 +59,4 @@ expect(err).to.exist | ||
it('should get a comments page without a page token', function () { | ||
this.timeout(60000) | ||
return fetchCommentPage('pkwOrteyQtY').then(function (page) { | ||
this.timeout(180000) | ||
return fetchCommentPage('BUCnjlTfXDw').then(function (page) { | ||
expect(page).to.have.a.property('comments').that.is.an('array') | ||
@@ -84,5 +84,5 @@ expect(page.comments).to.have.length.above(1) | ||
it('should get a different comments page with a page token', function () { | ||
this.timeout(60000) | ||
return fetchCommentPage('pkwOrteyQtY', null).then(function (page1) { | ||
fetchCommentPage('pkwOrteyQtY', page1.nextPageToken).then(function (page2) { | ||
this.timeout(180000) | ||
return fetchCommentPage('BUCnjlTfXDw', null).then(function (page1) { | ||
return fetchCommentPage('BUCnjlTfXDw', page1.nextPageToken).then(function (page2) { | ||
expect(page1).to.not.deep.equal(page2) | ||
@@ -111,6 +111,9 @@ expect(page2).to.have.a.property('comments').that.is.an('array') | ||
it('should get a different comments page with a page token using callbacks', function () { | ||
this.timeout(120000) | ||
return fetchCommentPage('pkwOrteyQtY', function (err, page1) { | ||
return fetchCommentPage('pkwOrteyQtY', page1.nextPageToken, function (err, page2) { | ||
it.only('should get a different comments page with a page token using callbacks', function (done) { | ||
this.timeout(180000) | ||
fetchCommentPage('BUCnjlTfXDw', function (err, page1) { | ||
fetchCommentPage('BUCnjlTfXDw', page1.nextPageToken, function (err, page2) { | ||
if (err) { | ||
return done(err) | ||
} | ||
expect(page1).to.not.deep.equal(page2) | ||
@@ -134,2 +137,3 @@ expect(page2).to.have.a.property('comments').that.is.an('array') | ||
} | ||
done() | ||
}) | ||
@@ -141,4 +145,4 @@ }) | ||
it('should include video information', function () { | ||
this.timeout(60000) | ||
return fetchCommentPage('pkwOrteyQtY', null).then(function (page) { | ||
this.timeout(180000) | ||
return fetchCommentPage('BUCnjlTfXDw', null).then(function (page) { | ||
expect(page).to.exist | ||
@@ -145,0 +149,0 @@ expect(page).to.have.a.property('videoCommentCount').that.is.a('number') |
@@ -10,3 +10,3 @@ var expect = require('chai').expect | ||
it('should get a session token', function () { | ||
this.timeout(30000) | ||
this.timeout(180000) | ||
return getSessionToken('eKEwL-10s7E').then(function (sessionToken) { | ||
@@ -19,3 +19,3 @@ expect(sessionToken).to.be.a('string') | ||
it('should remember a session token', function () { | ||
this.timeout(30000) | ||
this.timeout(180000) | ||
return getSessionToken('eKEwL-10s7E').then(function (sessionToken1) { | ||
@@ -22,0 +22,0 @@ return getSessionToken('eKEwL-10s7E').then(function (sessionToken2) { |
193428
28
953
126
Updatedyoutube-info@^1.1.1