diff options
Diffstat (limited to 'src/client/apis/youtube/youtubeApiSample.js')
| -rw-r--r-- | src/client/apis/youtube/youtubeApiSample.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/client/apis/youtube/youtubeApiSample.js b/src/client/apis/youtube/youtubeApiSample.js index 07c3add36..7f14f2d3e 100644 --- a/src/client/apis/youtube/youtubeApiSample.js +++ b/src/client/apis/youtube/youtubeApiSample.js @@ -1,7 +1,5 @@ -let fs = require('fs'); -let readline = require('readline'); -let { google } = require('googleapis'); -let OAuth2 = google.auth.OAuth2; +import { Utils } from "tslint"; + // If modifying these scopes, delete your previously saved credentials // at ~/.credentials/youtube-nodejs-quickstart.json @@ -10,18 +8,14 @@ let TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE) + '/.credentials/'; let TOKEN_PATH = TOKEN_DIR + 'youtube-nodejs-quickstart.json'; -function readFsFile() { - // Load client secrets from a local file. - fs.readFile('client_secret.json', function processClientSecrets(err, content) { - if (err) { - console.log('Error loading client secret file: ' + err); - return; - } - // Authorize a client with the loaded credentials, then call the YouTube API. - authorize(JSON.parse(content), getChannel); - }); + + +function authorizedGetChannel(apiKey) { + // Authorize a client with the loaded credentials, then call the YouTube API. + authorize(JSON.parse(apiKey), getChannel); } + /** * Create an OAuth2 client with the given credentials, and then execute the * given callback function. |
