Like the title, I'm working on an app that calls the YouTube APIs but sometimes my app makes too many requests that trigger the API quotas limit and thus making the app stop working due to error on the API server. The solution for this which I found on the Internet is to create multiple API keys and looping through them. But I'm having a headache figuring out how to make my Axios trying multiple API URLs before returning the data. Any tips or tricks on this?
Here is the sample code I tried:
async function getYoutubeVideoSnippet(id) { const response = await axios.all([ axios.get("https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=" + id +"&key=API_KEY" ), axios.get("https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=" + id +"&key=API_KEY" ), ]); return response.data;}