Streamlink: Access to 1080p YouTube videos in Python using Streamlink

Created on 25 May 2017  路  3Comments  路  Source: streamlink/streamlink

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._

question

Most helpful comment

<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).

All 3 comments

<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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saunaants picture saunaants  路  3Comments

bastimeyer picture bastimeyer  路  3Comments

sfkpmr picture sfkpmr  路  3Comments

JohnDoh666 picture JohnDoh666  路  3Comments

ahtcx picture ahtcx  路  3Comments