I am trying to write a node.js script to retrieve all youtube videos uploaded on a user's channel. Such as getting the video id, title, description, thumbnail, etc...
I know this would be alot of requests, so if I hit my request limit per minute for example, I'm fine with just setting it to wait/sleep for now perhaps.
So far the script I have will work, and launch, and accept a token to begin the request, but the videos.list line always fails with this error: videos.list err = GaxiosError: No filter selected. Expected one of: id, myRating, chart
As if it wants an id (of a video/playlist?) when i am trying to just retrieve every video uploaded by a user.
full file script.js
console.log('1')const readlineSync = require('readline-sync');console.log('2')const {google} = require('googleapis');console.log('3')//make google cloud project//add desktop token for client id//add youtube v3 api to project library//create api key, add to projectvar YOUTUBE_API_KEY = ''var YOUR_CLIENT_ID = `const youtube = google.youtube({ version: 'v3', auth: YOUTUBE_API_KEY});// Prompt the user to sign in to Google and get an access tokenconsole.log('Please go to the following URL to sign in to Google:');console.log(`https://accounts.google.com/o/oauth2/auth?client_id=${YOUR_CLIENT_ID}&response_type=code&scope=https://www.googleapis.com/auth/youtube.readonly&redirect_uri=http://localhost:3000/oauth2callback`);const accessToken = readlineSync.question('Enter the access token: ');// Use the access token to make a request to the YouTube APIyoutube.videos.list({ part: 'id,snippet', mine: true}, (err, res) => { if (err) { console.error('videos.list err = ', err); return; } console.log('got correctly ') // Print the IDs and thumbnails of the videos in the user's channel for (const video of res.data.items) { console.log(`Video ID: ${video.id}`); console.log(`Video thumbnail: ${video.snippet.thumbnails.default.url}`); }});