Throttle YT

This commit is contained in:
Mike Nolan 2025-02-12 09:17:45 -06:00
parent 4eb87e05d7
commit 7620d1e384
1 changed files with 4 additions and 2 deletions

View File

@ -12,15 +12,17 @@ HttpClient http=new HttpClient();
YoutubeClient ytc=new YoutubeClient(http); YoutubeClient ytc=new YoutubeClient(http);
ConcurrentStack<string> ids=new ConcurrentStack<string>(); ConcurrentStack<string> ids=new ConcurrentStack<string>();
bool isRunning=true; bool isRunning=true;
Box<long> videosDownloaded=0; Box<ulong> videosDownloaded=0;
async Task NewVideoDL() async Task NewVideoDL()
{ {
long dl; ulong dl;
lock(videosDownloaded) lock(videosDownloaded)
{ {
unchecked {
dl = videosDownloaded.Item++; dl = videosDownloaded.Item++;
} }
}
if((dl % 4) == 3) await Task.Delay(45000); if((dl % 4) == 3) await Task.Delay(45000);
} }