Hey,
I'm trying to get a 1080p capture of a YouTube video to my Python script.
I tried youtube-dl, FFmpeg and Livestreamer with no success.
I tried to use the following code in my Python script:
streams = streamlink.streams('https://www.youtube.com/watch?v=sD0NjbwqlYw')
but the value of the '1080p' key in the resulted output is:
<Stream()>
While lower quality streams give an HTTPStream object:
<HTTPStream('http://r1---sn-ivuoxu-ua8s .... MgI&itag=22')>
In addition to that I tried to use a Session and set the 'ffmpeg-ffmpeg' to the path of ffmpeg.exe (FFmpeg is also in PATH). There was no difference in the output.
When I run the following command on the command prompt:
streamlink https://www.youtube.com/watch?v=sD0NjbwqlYw 1080p --player-external-http
I am able to access the 1080p stream using the localhost address.
So is there a way to access the 1080p stream (Even without the audio) from the Python program?
BTW: Running streamlink in the shell is not useful for me.
I'm using Windows 10 with Python 3.5.1 32 bit.
_I'm really sorry if I shouldn't have posted this here or If I made any other mistakes._
<Stream()> is the __repr__ value for the Stream, it is likely the correct stream but __repr__ was not implemented for MuxedStream. You can probably double check the class by looking at streams['1080p'].__class__, just open the stream and read the video data :) If ffmpeg cannot be found the streams that require it will not be listed (same as the CLI).
Thanks! It works.
Thanks for the heads up @shahar603, I'm going to close this since it seems to be resolved.
Most helpful comment
<Stream()>is the__repr__value for theStream, it is likely the correct stream but__repr__was not implemented forMuxedStream. You can probably double check the class by looking atstreams['1080p'].__class__, just open the stream and read the video data :) Ifffmpegcannot be found the streams that require it will not be listed (same as the CLI).