Tyrrrz / YoutubeExplode

Abstraction layer over YouTube's internal API
MIT License
2.95k stars 493 forks source link

Explode the URL #50

Closed spoiledtechie closed 7 years ago

spoiledtechie commented 7 years ago

Hey, I won't mind pushing a PR myself, but wondering if you are still accepting them? Or you can do it yourself?

On this method, can you please return the URL of the downloadable video?

GetVideoInfoAsync

I don't want the streams, I simply want the URL to download it myself. Make sense? Just add it to the VideoInfo object. If you reply and let me know you can't or don't have time, Ill do it. Just wondering if you would be willing to do it first?

Tyrrrz commented 7 years ago

Hi. I don't get what's a "URL of the downloadable video"?

spoiledtechie commented 7 years ago

from only reviewing the code on Github, please correct me if I am wrong, but this url you use is defined here:

string url = streamDic.Get("url");

line 250: https://github.com/Tyrrrz/YoutubeExplode/blob/93b4834aa6fccdc99bbca6ec1b28853a8a42db04/YoutubeExplode/YoutubeClient.cs

Is this the URL that is used to pull the video down?

Tyrrrz commented 7 years ago

Yes. And in fact that's an URL of one of the streams. Also accessible from the output as mediaStreamInfo.Url.

spoiledtechie commented 7 years ago

Oh, is it just the video stream? If thats the case, is there another url that has both the video and audio combined?

BTW, thanks for responding so quickly.

Tyrrrz commented 7 years ago

Yeah, MixedStreams are the ones that have both. You can read a bit more on the topic here.

spoiledtechie commented 7 years ago

oh, this is interesting. So on the new YT stuff, you can't actually use a single URL for their videos...

Tyrrrz commented 7 years ago

Yep. Most videos still have MixedStreams, but they are limited in quality to 720p30fps.

spoiledtechie commented 7 years ago

So, are you able to put the URL into one of the objects, passing it back out within the video, after received? If the video does have a mixed stream?

Tyrrrz commented 7 years ago
var client = new YoutubeClient();
var videoInfo = await client.GetVideoInfoAsync("your_video");
string url = videoInfo.MixedStreams.OrderBy(s => s.VideoQuality).Last().Url; // take the highest quality mixed stream
Tyrrrz commented 7 years ago

Is the question answered?

spoiledtechie commented 7 years ago

thanks, that greatly helps!