async function runSample() {
  const auth = await authenticate({
    keyfilePath: path.join(__dirname, '../oauth2.keys.json'),
    scopes: ['https://www.googleapis.com/auth/youtube'],
  });
  google.options({auth});

  // the first query will return data with an etag
  const res = await getPlaylistData(null);
  const etag = res.data.etag;
  console.log(`etag: ${etag}`);

  // the second query will (likely) return no data, and an HTTP 304
  // since the If-None-Match header was set with a matching eTag
  const res2 = await getPlaylistData(etag);
  console.log(res2.status);
}
// a very simple example of getting data from a playlist
a very simple example of getting data from a playlist
a very simple example of getting data from a playlist
async function runSample() {
  const auth = await authenticate({
    keyfilePath: path.join(__dirname, '../oauth2.keys.json'),
    scopes: ['https://www.googleapis.com/auth/youtube'],
  });
  google.options({auth});
  const res = await getPlaylistData(null);
  const etag = res.data.etag;
  console.log(`etag: ${etag}`);
  const res2 = await getPlaylistData(etag);
  console.log(res2.status);
}
async function runSample ( ) { const auth = await authenticate ( { keyfilePath : path . join ( __dirname , '../oauth2.keys.json' ) , scopes : [ 'https://www.googleapis.com/auth/youtube' ] , } ) ; google . options ( { auth } ) ; const res = await getPlaylistData ( null ) ; const etag = res . data . etag ; console . log ( ` ${ etag } ` ) ; const res2 = await getPlaylistData ( etag ) ; console . log ( res2 . status ) ; }
a very simple example of getting data from a playlist
a very simple example of getting data from a playlist
// the first query will return data with an etag // the second query will (likely) return no data, and an HTTP 304 // since the If-None-Match header was set with a matching eTag