YoutubeExplode icon indicating copy to clipboard operation
YoutubeExplode copied to clipboard

No playable streams for a finished livestream

Open constructor-igor opened this issue 2 years ago • 1 comments

Version

ver. 6.2.0

Details

Try to download .mp3 from link https://www.youtube.com/watch?v=GlgIbLAYfIM

stack trace: " at YoutubeExplode.Videos.Streams.StreamClient.<GetManifestAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ValueTaskAwaiter1.GetResult()\r\n at YoutubeExplodeDemo.Program.<GettingMetadata>d__1.MoveNext() in D:\\MyDownloader\\MyDownloader\\YoutubeExplodeDemo\\Program.cs:line 108"

Steps to reproduce


        static async Task GettingMetadata(string link, string targetFile)
        {
            var youtube = new YoutubeClient();
            // You can specify video ID or URL
            var video = await youtube.Videos.GetAsync(link);

            var title = video.Title; // "Collections - Blender 2.80 Fundamentals"
            var author = video.Author; // "Blender"
            var duration = video.Duration; // 00:07:20
            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine($"title: {title}, author: {author}, duration: {duration}");

            var streamManifest = await youtube.Videos.Streams.GetManifestAsync(video.Id);
            // ...or highest bitrate audio-only stream
            var streamInfo = streamManifest
                .GetAudioOnlyStreams()
                .Where(s=> s.Container == Container.Mp4)
                .GetWithHighestBitrate();
            if (streamInfo != null)
            {
                // Get the actual stream
                //var stream = await youtube.Videos.Streams.GetAsync(streamInfo);

                // Download the stream to file
                //await youtube.Videos.Streams.DownloadAsync(streamInfo, $"{title}.mp3");
                await youtube.Videos.Streams.DownloadAsync(streamInfo, targetFile);
            }
        }

constructor-igor avatar Jul 21 '22 09:07 constructor-igor

The video doesn't have any full streams, and YTE currently doesn't support partial streams (#159).

When a livestream ends, it isn't converted into a "normal" video immediately – it stays as a concluded livestream for a while. In this state, its content is carried over partial stream chunks which need to be concatenated together (same as a running livestream, except new chunks are not generated over time). It should eventually be converted into a normal video, so you can try again later.

Tyrrrz avatar Jul 21 '22 09:07 Tyrrrz

Closing in favor of #159, which should fix this issue too

Tyrrrz avatar Feb 06 '23 13:02 Tyrrrz