Some time ago, perhaps a couple of months later, Googleβs download servers started counting down at startup much more than in the past. This is the error you see. There is nothing wrong with the code except for the fact that you are probably just reporting the error and not handling the error.
Most likely you are using the .Upload method. I say this because error 503 returns "The task was canceled." error using .UploadAsync method. I use .UploadAsync and .ResumeAsync in my download program.
When you get this error when using the .Upload method, it indicates that the server is too busy to process your request during the waiting period. Your program should recognize this error and call the .Resume method to resume loading.
Alternatively, you can increase the timeout from 100 seconds by default to something more using this statement: YouTube.HttpClient.Timeout = TimeSpan.FromMinutes(HTTP_CLIENT_TIMEOUT_MINUTES);
where YouTube is the variable name of your YouTubeService object .
In my experience, increasing the timeout is not as effective as processing the error and requesting that the download resume. For example, if you set a timeout of five minutes, your program will still fail if the answer is not returned after five minutes. Yes, it can happen. I usually set a timeout of up to two minutes, and then resume downloading if an error occurs. Almost always, the download will resume correctly.
Sometimes the download may be delayed immediately. For this reason, I count my resumes and reset the resume counter when the ProgressChanged IUploadProgress.Uploading event is fired. I have a limit of three retries and never exceeded that limit.
source share