This commit is contained in:
Ajay Ramachandran
2020-04-06 20:05:26 -04:00
parent 761fb7dafe
commit 9807d3e9c7
12 changed files with 529 additions and 126 deletions

View File

@@ -2,8 +2,18 @@ var config = require('../config.js');
// YouTube API
const YouTubeAPI = require("youtube-api");
YouTubeAPI.authenticate({
type: "key",
key: config.youtubeAPIKey
});
module.exports = YouTubeAPI;
var exportObject;
// If in test mode, return a mocked youtube object
// otherwise return an authenticated youtube api
if (config.mode === "test") {
exportObject = require("../../test/youtubeMock.js");
} else {
YouTubeAPI.authenticate({
type: "key",
key: config.youtubeAPIKey
});
exportObject = YouTubeAPI;
}
module.exports = exportObject;