Youtube Api

I have been using fetch since I created my fishing channel site and added new videos. I don't seem to find anything on how many videos from a certain playlist the fetch will receive. I currently have 10 videos on that one playlist. I am only getting 8 on the call is this normal I can't find any documentation implementing only 8 returns max
5 Replies
althepal78
althepal78•2mo ago
async function getInfo() {
const response = await fetch(
"https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=8&playlistId=PL6umJFQ6OsxqjNxqlDyHaBZ_WX_2Hhc_R&key=getyourownkey"
);
const result = await response.json();
console.log(result)
let resultSorted = [];
result.items.forEach((el) => {
resultSorted.push(el);
});
console.log(resultSorted)
return resultSorted.sort((a, b )=> {
return new Date( b.snippet.publishedAt) - new Date( a.snippet.publishedAt)
});
}
async function getInfo() {
const response = await fetch(
"https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=8&playlistId=PL6umJFQ6OsxqjNxqlDyHaBZ_WX_2Hhc_R&key=getyourownkey"
);
const result = await response.json();
console.log(result)
let resultSorted = [];
result.items.forEach((el) => {
resultSorted.push(el);
});
console.log(resultSorted)
return resultSorted.sort((a, b )=> {
return new Date( b.snippet.publishedAt) - new Date( a.snippet.publishedAt)
});
}
Chris Bolson
Chris Bolson•2mo ago
You are only getting 8 results as you have maxResults=8 defined in your URL. Remove or change this value to something higher and you should get all of them. Apparently the default value is 5 and you can set anything from 0 to 50.
althepal78
althepal78•2mo ago
I am so dumb I copied that string never noticed that was too busy adding the playlist and key lmao
Chris Bolson
Chris Bolson•2mo ago
Easily done 😆
althepal78
althepal78•2mo ago
I do this section on my computer and copy the results into another file so I don't have my key out there. Even though my new key is for public information LOL so I just copied that damn thing lmao thanks wow I am so tired sometimes lol
Want results from more Discord servers?
Add your server