Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

Youtube Data API is getting called too many times

$
0
0

So I set up the youtube data api and I added following code to fetch 4 videos on my page: Works fine for like 3 hours before the daily quota of 10.000 is reached. I tested it locally and everything worked fine there. Also: I´m using the search resource and its list method, which result in a quota cost of 100 per call, but that normally shouldnt be a problem, because its a small page.Thx in advance.

const youtubeWrapper = document.querySelector(".youtube-playlist");async function getFloVideoData(){    const response = await fetch("https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=UC78M9ne3s4_XpcmPM4r0Xxw&maxResults=4&order=viewCount&key=myAPIkey");    const data = await response.json();    const {items} = data;    items.forEach((item) => {      youtubeWrapper.innerHTML += `<div class="video-container"><a href="https://www.youtube.com/watch?v=${item.id.videoId}"><img src="${item.snippet.thumbnails.medium.url}"></a><p>${item.snippet.title}</p><p>${item.snippet.publishTime}</p></div>`;    }); )}setTimeout(getFloVideoData(),3600000); //call function every hour too limit API-Calls

Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>