Thursday, 1 March 2018

Having trouble setting up youtube data api with nodejs

I'm following along with the youtube docs getting started with node. http://ift.tt/2F8qR6A I have the client_secret.json in the working directory file downloaded however I'm getting this error when launching> mason@lubuntu:~/Desktop/chentabot$ node quickstart.js undefined:1 SyntaxError: Unexpected end of JSON input at Object.parse (native) at /home/mason/Desktop/chentabot/quickstart.js:42:39 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:447:3) line 42 refers to this section of the code// Check if we have previously stored a token. fs.readFile(TOKEN_PATH, function(err, token) { if (err) { getNewToken(oauth2Client, callback); } else { oauth2Client.credentials = JSON.parse(token); callback(oauth2Client); } }); and it seems that it's using the json file called youtube-nodejs- quickstart.json when its defined earlier on the sample. I can not however find this file or the path its located on my system.var TOKEN_PATH = TOKEN_DIR + 'youtube-nodejs- quickstart.json'; Any idea on how to proceed? For context I ultimately want to be able to use this api to update and remove videos on a public youtube playlist.

Submitted March 01, 2018 at 09:14PM by quadreon

No comments:

Post a Comment