Closed nlogozzo closed 3 years ago
I think this could be related to: https://github.com/Tyrrrz/YoutubeExplode/issues/573
More info affecting youtube-dl too: https://github.com/ytdl-org/youtube-dl/issues/29326
did u use download with chunks like this ? and can you give me a sample url ?
https://github.com/omansak/libvideo/blob/master/src/libvideo.debug/CustomYoutubeClient.cs
This is how I download:
private async Task<string> DownloadVideoAsync()
{
Status = "Downloading...";
Progress = 3;
var video = await YouTube.Default.GetVideoAsync(VideoLink);
var videoBytes = await video.GetBytesAsync();
var videoFilePath = $"{_saveFolder}/{NewFilename}{video.FileExtension}";
await File.WriteAllBytesAsync(videoFilePath, videoBytes);
Progress = 6;
return videoFilePath;
}
And like I said, it happens with different videos at different points. One time the video will download normally, the next super slow. I urge you to look at the issues I linked, I believe they might explain what's going on.
use dowload with chunk. youtube sometimes reduces download speed for +10mb videos.
Example Chunks Download : https://github.com/omansak/libvideo/blob/master/src/libvideo.debug/CustomYoutubeClient.cs
I'm currently working on another project but as soon as I get to this one I'll try downloading via chunks and let you know how it goes!
I have this code to download a video
Now sometimes it works and sometimes it doesn't. No error is throw however upon break point inspection sometimes the code doesn't go past this line
var videoBytes = await video.GetBytesAsync();
yet again no error is thrown. And it's not like its specific video issues cause if I go to run it again with the same video, it works no issues. The line that seems it can't get past, it eventually got past it after two/three minutes or even longer whereas for the same code for the same video run a separate time, GeBytesAsync was instant. After continually downloading videos I finally got this error (where I guess it's just taking too long and timesout):