Hello, I was trying to download a video today and an exception popped up, that I haven't seen before:
(styliezed error from catch block calling $"Unknown error for url {videoUrl}\nMessage:\n{e.Message}\nStacktrace:\n{e.StackTrace}" )
Unknown error for url https://youtu.be/rIX35SBA_lQ
Message:
Received an unexpected EOF or 0 bytes from the transport stream.
Stacktrace:
at System.Net.Security.SslStream.FillBufferAsync[TIOAdapter](TIOAdapter adapter, Int32 numBytesRequired)at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory1 buffer)at System.Net.Http.HttpConnection.ReadAsync(Memory1 destination)at System.Net.Http.HttpConnection.ContentLengthReadStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken)at YTDownloader.Program.Download(YouTubeVideo stream, String fileName, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 644at YTDownloader.Program.DownloadProgressiveVideo(IList1 streams, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 544at YTDownloader.Program.DownloadVideo(IList1 streams, Arguments parsedArgs, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 466at YTDownloader.Program.HandleDownload(IList1 streams, Arguments parsedArgs, String videoUrl, ProgressBar progressBar) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 195
I am downloading the stream using buffer
byte[] buffer = new byte[bufferSize];using ( var YTStream = await stream.StreamAsync() )using ( var outFileStream = System.IO.File.OpenWrite(fileName)){int bytesRead;while ( (bytesRead = await YTStream.ReadAsync(buffer, 0, bufferSize)) > 0){await outFileStream.WriteAsync(buffer, 0, bytesRead);} }
I am downloading 720p video with audio.
Other videos like https://youtu.be/l06QZx2zwZI download just fine.
Do you have an ideas what might be the problem?
P.S.: Sorry for the poor formatting of the code, I haven't yet properly learnt how to use markdown with code.
Hello, I was trying to download a video today and an exception popped up, that I haven't seen before: (styliezed error from catch block calling
$"Unknown error for url {videoUrl}\nMessage:\n{e.Message}\nStacktrace:\n{e.StackTrace}"
)Unknown error for url https://youtu.be/rIX35SBA_lQ Message: Received an unexpected EOF or 0 bytes from the transport stream. Stacktrace:
at System.Net.Security.SslStream.FillBufferAsync[TIOAdapter](TIOAdapter adapter, Int32 numBytesRequired)
at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory1 buffer)
at System.Net.Http.HttpConnection.ReadAsync(Memory1 destination)
at System.Net.Http.HttpConnection.ContentLengthReadStream.ReadAsync(Memory1 buffer, CancellationToken cancellationToken)
at YTDownloader.Program.Download(YouTubeVideo stream, String fileName, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 644
at YTDownloader.Program.DownloadProgressiveVideo(IList1 streams, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 544
at YTDownloader.Program.DownloadVideo(IList1 streams, Arguments parsedArgs, Boolean masterProgressBarPresent) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 466
at YTDownloader.Program.HandleDownload(IList1 streams, Arguments parsedArgs, String videoUrl, ProgressBar progressBar) in C:\Users\mnagy\Projects\C#\YTDownloader\YTDownloader\Program.cs:line 195
I am downloading the stream using buffer
byte[] buffer = new byte[bufferSize];
using ( var YTStream = await stream.StreamAsync() )
using ( var outFileStream = System.IO.File.OpenWrite(fileName))
{
int bytesRead;
while ( (bytesRead = await YTStream.ReadAsync(buffer, 0, bufferSize)) > 0)
{
await outFileStream.WriteAsync(buffer, 0, bytesRead);
}
}
I am downloading 720p video with audio. Other videos like https://youtu.be/l06QZx2zwZI download just fine. Do you have an ideas what might be the problem?
P.S.: Sorry for the poor formatting of the code, I haven't yet properly learnt how to use markdown with code.