streamlink / streamlink-twitch-gui

A multi platform Twitch.tv browser for Streamlink
https://streamlink.github.io/streamlink-twitch-gui/
MIT License
2.69k stars 203 forks source link

Streamlink workaround guide for Twitch API issue (with screenshots) #682

Closed bastimeyer closed 4 years ago

bastimeyer commented 5 years ago

This is an addition to the Streamlink workaround option 2 which I've posted in the Streamlink issue: https://github.com/streamlink/streamlink/issues/2680#issuecomment-552024753

Please read the linked post first, so you know what and why you are doing this. Thanks.

PLEASE NOTE This is only a workaround for watching streams via Streamlink. Certain parts of the Twitch GUI still won't work due to this Twitch API issue, but at least you'll be able to browse and launch streams via Streamlink Twitch GUI.


  1. Get your OAuth token from the Twitch website Open the dev-tools of your web browser (usually F12 or "inspect element") and then go to the network tab. Make sure that network activity is being recorded (default behavior). Chromium dev tools
  2. Enable advanced settings in the main settings menu of the Twitch GUI 1
  3. Add the custom --twitch-oauth-token=VALUE Streamlink parameter 2
  4. Disable "Twitch.tv login" - login sharing with Streamlink If you don't do this, the custom parameter will be overridden by the Twitch GUI. 3
arrowgent commented 5 years ago

sorry, no it still doesnt work.

streamlink 1.2.0 streamlink-twitch-gui 1.8.1 ubuntu linux 18.04 x64

bastimeyer commented 5 years ago

@arrowgent You must have misspelled something or somehow done something else wrong.

I won't be discussing the Twitch API issue here though, so all I can tell you is to follow the instructions precisely or wait for the next release with proper fixes (release date unknown). Both workaround options are working 100% in the mean time.

TheSpyder commented 5 years ago

I got a huge error using --twitch-oauth-token=VALUE as you describe.

I looked up the command line help and it's --twitch-oauth-token VALUE (space, not =). Works great now.

bastimeyer commented 5 years ago

Streamlink, which uses Python's argparse lib, accepts both notations, --param=value and --param value.

If you're using the = notation, the whole parameter (name and value) needs to be one single argument, which you can wrap into quotation marks. This isn't necessary here though due to the format of the OAuth token. If the parameter value contains spaces or other delimiting characters, it won't work, first because it would split the parameter name and value into two arguments, which can't be done when using the = notation, and second because the value would simply be wrong, so make sure that what you copy is correct.

jtux270 commented 5 years ago

The solution works fine for viewing the followed streams but the 'My/Games' menu still shows 410, just to mention it here. Anyway it's too much to ask right now I guess.

bastimeyer commented 5 years ago

PLEASE NOTE This is only a workaround for watching streams via Streamlink. Certain parts of the Twitch GUI still won't work due to this Twitch API issue, but at least you'll be able to browse and launch streams via Streamlink Twitch GUI.

the 'My/Games' menu still shows 410

https://github.com/streamlink/streamlink-twitch-gui/issues/681#issuecomment-553574989

Everything that uses the same private API doesn't work, this includes

jenia123777 commented 5 years ago

If it doesn’t work for you. Check it out - "--param=value". There must be no space after the "" !!! --param=value or --param value.

TheSpyder commented 5 years ago

ok, yes, my problem was in that all the copy/paste required for the workaround an extra space seems to have crept into the field somewhere and that broke using =. Sorry :)

bogganj94 commented 5 years ago

Thanks for the help, i got this to work with no problems

sterob commented 5 years ago

It works. Thanks OP.

bastimeyer commented 5 years ago

Third party tokens usually last until you revoke permissions of the app which the token has been generated from. You can do this in the connections menu of your Twitch account settings. They also get reset if you generate a new one by logging in again.

Tokens from the Twitch website are valid until you logout there. There is no time limit / expiration date, otherwise you would have to re-login on the website too.

arturo-buitrago commented 5 years ago

Works perfectly, thanks for your work, Basti.

TamashiiDoku commented 5 years ago

thank you basti, works on my machine

MetalDevOps commented 4 years ago

Works fine here, thanks.

bastimeyer commented 4 years ago

Streamlink 1.3.0 has been released this morning. If you upgrade, you won't need to apply the workaround anymore.

There will also be a new Streamlink Twitch GUI release very soon (probably tomorrow). Streamlink 1.3.0 will be the new min requirement then for launching streams. https://github.com/streamlink/streamlink-twitch-gui/blob/master/CHANGELOG.md

If you don't want to wait, build the Twitch GUI yourself: https://github.com/streamlink/streamlink-twitch-gui/blob/v1.8.1/CONTRIBUTING.md#developing-and-building

synap5e commented 4 years ago

@bastimeyer have you considered letting the user log in to twitch inside streamlink where you can capture the user's own api key?

https://passport.twitch.tv/login returns {"access_token": "...", ...} upon successful login flow so it should be possible to observe this or modify the calling scripts to extract the response if the login flow is taking place inside streamlink-twitch-gui.

bastimeyer commented 4 years ago

@synap5e The OAuth token from Twitch's website is irrelevant now in Streamlink 1.3.0 as it doesn't make use of auth data anymore (except for logging the user name, which was not removed). See my comment from yesterday on the locked plugin issue thread: https://github.com/streamlink/streamlink/issues/2680#issuecomment-557605851 And in the Twitch GUI, this kind of OAuth token doesn't serve any purpose.

Regarding the auth flow, the Twitch GUI explicitly switched from an internal authentication (with its own client-id) to using a local webserver and letting the user log in via their web browser almost four years ago (see 46cac0b, #209). That has not just been done because of technical issues, but also for security and trust reasons. Authentication happens in the web browser and won't be changed.

synap5e commented 4 years ago

Yeah I can understand wanting to steer clear of the security headaches of capturing login and it's an extra maintenance burden.

I have been following the other thread, I just thought capturing login might be a way to avoid breaking access to restricted streams/vods and other features that come with being logged in (or if twitch decides to take action against using their client ID). It's not really an issue for me (I'm happy copying the token from devtools if I need to), just something I thought might be worth suggesting.

Lastly I just wanted to say thanks for the work you do on streamlink. I use it both to watch streams and as a library to resolve .m3u8 playlists for some other projects 😄

bastimeyer commented 4 years ago

v1.9.0 has been released now (currently being built while writing this): https://github.com/streamlink/streamlink-twitch-gui/releases/latest

As mentioned earlier, Streamlink 1.3.0 has been released yesterday and you don't have to apply this workaround anymore.

Closing the thread. Please upgrade.

bastimeyer commented 4 years ago

Btw, you can keep the custom parameter, but since it's not doing anything anymore, it's probably better to just remove it, in case something changes in the future and you forget about it.