Slow down YT requests

Slow YT requests
This commit is contained in:
Mike Nolan 2025-02-12 15:00:23 +00:00
parent dbc15fefbb
commit 947c149b40
1 changed files with 13 additions and 1 deletions

View File

@ -12,6 +12,18 @@ HttpClient http=new HttpClient();
YoutubeClient ytc=new YoutubeClient(http); YoutubeClient ytc=new YoutubeClient(http);
ConcurrentStack<VideoId> videoIds=new ConcurrentStack<VideoId>(); ConcurrentStack<VideoId> videoIds=new ConcurrentStack<VideoId>();
bool isRunning=true; bool isRunning=true;
long videosDownloaded=0;
async Task NewVideoDL()
{
long dl;
lock(videosDownloaded)
{
dl = videosDownloaded++;
}
if((dl % 6) == 5) await Task.Delay(60000);
}
async Task AddVideo(VideoId id) async Task AddVideo(VideoId id)
{ {
@ -53,7 +65,7 @@ async Task AddVideo(VideoId id)
} }
client.Disconnect(); client.Disconnect();
await Task.Delay(15000); await NewVideoDL();
} }
} }