ReactingMe
03/11/2022, 5:29 AMexport async function getServerSideProps({ req }) {
//Base Url
const gBaseUrl = 'https://www.googleapis.com/youtube/v3';
//Supabase related
//Insert many rows
// const { data, error } = await supabase
// .from('table')
// .insert([
// { some_column: 'someValue' },
// { some_column: 'otherValue' },
// ])
const channelID = [];
for (const channel of channelList) {
const channelData = await fetch(
`${gBaseUrl}/channels?part=snippet,contentDetails,statistics&id=${channel.channelID}&key=${process.env.YOUTUBE_API_KEY}`
).then((res) => res.json());
channelID.push(channelData.items); // Need to save "channelData.items" coming from YoutubeAPI to the database.
}
//Return data
return {
props: {
channelID,
},
};
}
What to do?Needle
03/11/2022, 5:29 AM/title
command!
Done using the thread?
Click the button below to archive it.Needle
03/11/2022, 5:31 AMNeedle
03/11/2022, 5:31 AM