From ee3f1b4638b4453061bb927da72139b52fd9fadc Mon Sep 17 00:00:00 2001 From: LuanRT Date: Wed, 5 Jan 2022 16:31:52 -0300 Subject: [PATCH] chore: update examples --- examples/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/index.js b/examples/index.js index 0cbdd057..543106c6 100644 --- a/examples/index.js +++ b/examples/index.js @@ -7,18 +7,18 @@ const creds = fs.existsSync(creds_path) && JSON.parse(fs.readFileSync(creds_path async function start() { const youtube = await new Innertube(); - - youtube.on('auth', (data) => { + + youtube.ev.on('auth', (data) => { if (data.status === 'AUTHORIZATION_PENDING') { console.info(`Hello!\nOn your phone or computer, go to ${data.verification_url} and enter the code ${data.code}`); } else if (data.status === 'SUCCESS') { - fs.writeFileSync(creds_path, JSON.stringify({ access_token: data.access_token, refresh_token: data.refresh_token, expires: data.expires })); + fs.writeFileSync(creds_path, JSON.stringify(data.credentials)); console.info('Successfully signed-in, enjoy!'); } }); - - youtube.on('update-credentials', (data) => { - fs.writeFileSync(creds_path, JSON.stringify({ access_token: data.access_token, refresh_token: data.refresh_token, expires: data.expires })); + + youtube.ev.on('update-credentials', (data) => { + fs.writeFileSync(creds_path, JSON.stringify(data.credentials)); console.info('Credentials updated!', data); });