Closed StefH closed 3 years ago
try download with chunks.
Chunk : https://stackoverflow.com/questions/13566302/download-large-file-in-small-chunks-in-c-sharp
Sample Project for UWP (u can extract chunk) : https://github.com/omansak/UWP-Download-in-Chunks
I'm using this code:
var youTube = YouTube.Default; // starting point for YouTube actions var videos = await youTube.GetAllVideosAsync("https://www.youtube.com/watch?v=spVJOzF0EJ0"); var v = videos.ToList(); var audio = v.Where(vi => vi.AdaptiveKind == AdaptiveKind.Audio).OrderByDescending(vi => vi.AudioBitrate).First(); Console.WriteLine(DateTime.Now.ToString("O")); var bytes = await audio.GetBytesAsync(); Console.WriteLine(DateTime.Now.ToString("O")); await File.WriteAllBytesAsync("c:\\dev\\" + audio.FullName, bytes);
And downloading a 7 MB audio file takes ~ 50 seconds ?:
2021-04-17T09:56:46.2859815+02:00 2021-04-17T09:57:36.2790347+02:00
bro did u fixed ?
Hello @nycr0x, for now I use https://github.com/Tyrrrz/YoutubeExplode which is faster.
For my example project see: https://github.com/StefH/Blazor.YouTubeDownloader.
I wrote a custom client , you can take a reference it
https://github.com/omansak/libvideo/blob/master/src/libvideo.debug/CustomYoutubeClient.cs
I'm using this code:
And downloading a 7 MB audio file takes ~ 50 seconds ?: