Some formats often can't be downloaded (example itag 136)
See original GitHub issueI started using YouTubeExplode a few days ago (I think I have the newest version). I were using youtube-dl before, but I switched because your code is more readable (mainly because I prefer C# over python).
From what I can tell, you are getting the Download links of videos the same way youtube-dl gets them. But youtube-dl won’t try to download the videos from their URLs if their URLs don’t work. There are video formats that (I think always) get uploaded as DASH-segments (many small parts that have to be combined to get the full video). The 2 formats I have most experience with are 136 (DASH mp4 720p video only) and 137 (DASH mp4 1080p video only).
These formats sometimes have a working download URL and sometimes have not. If you want to consistently download these formats, you need to download the DASH-segments and combine them locally (youtube-dl does that). If I try to download the videoformat 136 of this video: https://www.youtube.com/watch?v=Lhw5xo67tdE with youtube-dl, it works. With YoutubeExplode, it does not.
I hope you can implement such a feature as well.
Here is code I used to test YoutubeExplodes behavior towards DASH-format 136 compared to a the normal format 22.
using System;
using YoutubeExplode;
using YoutubeExplode.Models.MediaStreams;
namespace ConsoleApp1{
class Program{
static void Main(string[] args){
Program program = new Program();
program.testFortmats();
Console.ReadLine();
}
public async void testFortmats() {
var videoId = "Lhw5xo67tdE";
var client = new YoutubeClient();
//getting information about all available formats (and more)
var streamInfoSet = await client.GetVideoMediaStreamInfosAsync(videoId);
var infos = streamInfoSet.GetAll();
//walk through each individual format available
foreach (MediaStreamInfo info in infos){
//print the DownloadURL of format 22 (if available)
if (info.Itag == 22){
Console.WriteLine("Download URL for format 22:");
Console.WriteLine(info.Url + "\n");
}
//print the DownloadURL of DASH-format 136 (if available)
if (info.Itag == 136){
Console.WriteLine("Download URL for format 136:");
/*this URL sometimes works, sometimes does not. copy it into
**your browser and test it. If it does not work in my browser, I cannot
**download it either (I guess this behavior should be similar for you)*/
Console.WriteLine(info.Url + "\n");
}
}
}
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (7 by maintainers)
Okay, I see. So, first of all, I need to fix the filtering logic so that partial streams are not shown, because currently, YTE doesn’t know how to download them. Then, I suppose, a separate issue needs to be created to add support for downloading of partial streams.
Hm. I will have to keep trying then. I know sometimes I was able to get different itag sets one day apart.