question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The response ended prematurely

See original GitHub issue

This video is not downloadable with your client: https://www.youtube.com/watch?v=rFCE6XpC2cw

Enter YouTube video ID or URL: rFCE6XpC2cw
Downloading stream: 720p / mp4... Completed √
Unhandled exception. System.IO.IOException: The response ended prematurely, with at least 88354044 additional bytes expected.
   at System.Net.Http.HttpConnection.ContentLengthReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at YoutubeExplode.ReverseEngineering.YoutubeMediaStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) in YoutubeExplode\YoutubeExplode\ReverseEngineering\YoutubeMediaStream.cs:line 88
   at YoutubeExplode.Internal.Extensions.StreamExtensions.CopyBufferedToAsync(Stream source, Stream destination, Byte[] buffer, CancellationToken cancellationToken) in YoutubeExplode\YoutubeExplode\Internal\Extensions\StreamExtensions.cs:line 13
   at YoutubeExplode.Internal.Extensions.StreamExtensions.CopyToAsync(Stream source, Stream destination, IProgress`1 progress, CancellationToken cancellationToken) in YoutubeExplode\YoutubeExplode\Internal\Extensions\StreamExtensions.cs:line 28
   at YoutubeExplode.Videos.Streams.StreamClient.CopyToAsync(IStreamInfo streamInfo, Stream destination, IProgress`1 progress, CancellationToken cancellationToken) in YoutubeExplode\YoutubeExplode\Videos\Streams\StreamClient.cs:line 310
   at YoutubeExplode.Videos.Streams.StreamClient.DownloadAsync(IStreamInfo streamInfo, String filePath, IProgress`1 progress, CancellationToken cancellationToken) in YoutubeExplode\YoutubeExplode\Videos\Streams\StreamClient.cs:line 320
   at YoutubeExplode.DemoConsole.Program.Main() in YoutubeExplode\YoutubeExplode.DemoConsole\Program.cs:line 40
   at YoutubeExplode.DemoConsole.Program.<Main>()

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Tyrrrzcommented, Nov 26, 2020

No idea. The problem is that YouTube returns a response, but ends it prematurely. We can’t tell YouTube to make a proper response. In fact, YouTube’s frontend is known to be filled with lots of bugs which are mostly worked around with try/catches and retries.

0reactions
qtlincommented, Dec 8, 2020

Thank you, @VahidN , I was able to run YoutubeExplode.DemoConsole on both, Windows and Linux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Getting HttpRequestExceptions: The response ended ...
Sadly, the innermost exception IS "The response ended prematurely." Looks like the SERVER is closing the socket too soon. Though it might be ......
Read more >
HttpClient The response ended prematurely · Issue #72177
Description I'm running a legacy HTTP server and I randomly get the The response ended prematurely error while receiving the payload body.
Read more >
QueryAsync HttpRequestExceptions - Response ended ...
Running a DotNet Core 3.1 app with the Couchbase .NET client 2.7.26. I recently updated a test server from Couchbase Enterprise Edition ...
Read more >
System.IO.IOException - The response ended prematurely
IOException Message: The response ended prematurely. StackTrace: at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request ...
Read more >
"The response ended prematurely" after one hour of...
Solved: I'm trying to download a large (80Gb) file from the Dropbox servers. After *exactly* one hour, I get an exception indicating that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found