This just started happening today sadly.
Unable to open URL: https://api.twitch.tv/api/channels/sjow/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/sjow/access_token.json?as3=t&platform=_)
This happens for any stream I try to start. Not sure what is wrong.
same
It was working and suddenly this happened to me as well.
Well, guess I am not alone at the very least. Hopefully some light can be shed on how to fix it.
they have removed that from the api it looks like as when i visit the link it gives it shows this
{"error":"Gone","status":410,"message":"this API has been removed."}
How do we fix it?
Looks like Twitch has changed their private API endpoints which Streamlink needs to acquire the access token.
Please try to keep the number of posts low in this thread and only post informations which are necessary to fix this issue, so that this thread doesn't end in a big mess. Thanks!
Ok, this is weird.
If you curl the access_token.json request with the same headers and parameters which your browser makes when you're watching a stream on Twitch's website, it's returning 200 with the necessary JSON data.
However, if you're using an oauth token generated by Streamlink's or Streamlink Twitch GUI's API client_id, then it's returning a 410 error with {"error":"Gone","status":410,"message":"this API has been removed."}.
Providing no or an invalid oauth token results in an error 400 with {"error":"Bad Request","status":400,"message":"No client id specified"}.
This doesn't necessarily mean that Twitch is actively blocking Streamlink, but it's weird that their website is still using the same API endpoints when they remove them for 3rd party applications (without deprecating them).
I currently don't have access to my computer. This makes debugging this a bit painful. If somebody has more informations, please share.
Can we still make OAuth tokens for Streamlink? Because I had deleted mine when I noticed using a OAuth token caused the SurePlay advertisements to get injected into the m3u8 playlists where as using without a OAuth token made everything "ad free".
Noting that instead of the current URL
https://api.twitch.tv/api/channels/<channel_name>/access_token.json or the suggested https://api.twitch.tv/api/channels/<channel_name>/access_token.json?as3=t&platform=_&oauth_token=<oauth-token> (which is odd cause it only adds parameters)
Twitch website (in FF at least) uses (with extra params for webplayer & etc)
https://api.twitch.tv/api/channels/<channel_name>/access_token?oauth_token=<oauth_token>
Tested this from FF and from Curl successfully but I don't know what the successful result should include.
Looks like the API is working correctly again?
The issue just resolved itself on my end while trying to find what's different between the site and streamlinks requests...
I can confirm it's suddenly working on my end too:
$ streamlink --loglevel debug twitch.tv/cptsledge
[cli][debug] OS: Linux-4.4.0-22-generic-x86_64-with-LinuxMint-17.3-rosa
[cli][debug] Python: 3.4.3
[cli][debug] Streamlink: 1.2.0
[cli][debug] Requests(2.21.0), Socks(1.7.1), Websocket(0.56.0)
[cli][info] Found matching plugin twitch for URL twitch.tv/cptsledge
[plugin.twitch][debug] Getting live HLS streams for cptsledge
[utils.l10n][debug] Language code: en_US
Available streams: audio_only, 160p (worst), 360p, 480p, 540p60 (best)
Yea it is working now for me all of the sudden as well. I am not a programmer by any means so if this is a stupid question I apologies.
Is it possible that the broken API was just a temporary thing on twitches side?
@gimli520 It's possible there was some sort of issue with oauth token access to whatever API they are using. Could have just been a bug in a deployment or something else. Without details from Twitch we won't know. I'll leave this open for now just in case it starts happening again.
can confirm streamlink is working on multiple computers too 12:13 pst
This isn't the first time of this happening either.
I noticed same thing two days ago except it only lasted 15 min instead of an hour like it did today.
Both of them seem to have started around 11am PST.
I wonder if this is only affecting those users who have ticked the "skip advertisements embedded into streams" box? Twitch seems to be pushing their ads hard in recent months
I wonder if this is only affecting those users who have ticked the "skip advertisements embedded into streams" box? Twitch seems to be pushing their ads hard in recent months
I'm pretty sure this is not the case. I experienced the same issue with just streamlink and no ad skipping enabled.
All that Streamlink does when skipping ads is discarding the ad segments in the concatenated stream. They are being downloaded just like regular segments, so Twitch doesn't know that the user is skipping ads. All they know is that Streamlink and not their web player is being used.
https://github.com/streamlink/streamlink/pull/2372#issuecomment-476496970
The issue here was the (private) API endpoint for aquiring the stream access token, which is basically the first thing Streamlink has to do before it can get the HLS stream.
I'm not sure what exactly Twitch has done to break it, and I also don't know if it's true that it broke for the second time (we would have seen more reports then), but it looks like it was not intentional and just a bug on their end. Maybe it's related to their new methods of detecting view bots, who knows.
Seems like this just started happening again:
streamlink --loglevel debug twitch.tv/cptsledge
[cli][debug] OS: macOS 10.14.6
[cli][debug] Python: 3.7.4
[cli][debug] Streamlink: 1.2.0
[cli][debug] Requests(2.22.0), Socks(1.7.1), Websocket(0.56.0)
[cli][info] Found matching plugin twitch for URL twitch.tv/cptsledge
[plugin.twitch][debug] Getting live HLS streams for cptsledge
[plugin.twitch][info] cptsledge is hosting pasky
[plugin.twitch][info] switching to pasky
[plugin.twitch][debug] Getting live HLS streams for pasky
error: Unable to open URL: https://api.twitch.tv/api/channels/pasky/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/pasky/access_token.json?as3=t&platform=_)
I can confirm here the issue is reoccurring.
$ streamlink --loglevel debug twitch.tv/mr_icarus 360p
[cli][debug] OS: Linux-4.4.0-22-generic-x86_64-with-LinuxMint-17.3-rosa
[cli][debug] Python: 3.4.3
[cli][debug] Streamlink: 1.2.0
[cli][debug] Requests(2.21.0), Socks(1.7.1), Websocket(0.56.0)
[cli][info] Found matching plugin twitch for URL twitch.tv/mr_icarus
[plugin.twitch][debug] Getting live HLS streams for mr_icarus
error: Unable to open URL: https://api.twitch.tv/api/channels/mr_icarus/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/mr_icarus/access_token.json?as3=t&platform=_)
Just like yesterday, requests with a client ID and OAuth token from Streamlink or Streamlink Twitch GUI are being "blocked". If you use an OAuth token from the Twitch website and their client ID, the access token requests are working just fine.
https://github.com/streamlink/streamlink/issues/2680#issuecomment-550475041
Can anybody confirm that it's not working with other 3rd party client IDs as well? I don't have any other applications registered on Twitch so I don't have one at hand.
There's unfortunately nothing which can be done here other than making Twitch aware of this issue, well, if it's an unintentional bug.
Can anybody confirm that it's not working with other 3rd party client IDs as well? I don't have any other applications registered on Twitch so I don't have one at hand.
@bastimeyer I just test that
using my app ID NOK 410, using twitch website ID OK 200, using twitch ID and a user generated oauth_token for my ID NOK 410 as expected...
Nothing to do when using a third party ID.
How can I give Streamlink my own clientID and Oauth token?
The client ID is hardcoded
https://github.com/streamlink/streamlink/blob/1.2.0/src/streamlink/plugins/twitch.py#L42
but you should be able to override the client ID header via --http-header.
Using curl is much simpler though:
curl -s \
-H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: PUBLIC_CLIENT_ID_HERE' \
-H 'Authorization: OAuth PRIVATE_OAUTH_TOKEN_HERE' \
'https://api.twitch.tv/api/channels/CHANNEL_NAME_HERE/access_token.json'
@bastimeyer Running this curl request (with a proper client id and oauth token) returns the same error {"error":"Gone","status":410,"message":"this API has been removed."}
We have an application that watches twitch streams in a similar fashion to streamlink. We got things working with this change: https://github.com/ekimekim/wubloader/commit/94d81d708f8630221de41e6757d6c28ec9965b37
Happening here as well sadly. Was working earlier but getting the same exact error.
I remember Livestreamer broke a long time ago when twitch changed some things having to do with AuthTokens. The way it was fixed was by adding your AuthToken heading into the options folder (I really hope I explained that correctly and I don't sound dumb) if I remember correctly.
Would that fix this problem as well? Or is this a separate issue?
what would be the consequences of using that ID?
from
https://github.com/ekimekim/wubloader/commit/94d81d708f8630221de41e6757d6c28ec9965b37
anyone knows???
@gimli520
This was a completely different issue
@ekimekim
You are replacing your own client ID with the one of Twitch's website. You are abusing their system with that change and are probably breaking ToS (not 100% sure).
we need a third party app ID that works, must have one I tested a third party app that was working when my doesnot at the same time, but I don't know what ID it uses and why works...
will investigate
It's interesting: the api stopped working for me at 21:00 CET so it worked a little bit longer for all europeans...
Technical issue aside, do we know if it is a move from twitch to prevent third party clients? It would be a shame if we had to play cat and mouse to keep it working.
@kuon
The only reason they would show a 410 with the message "this API has been removed" is to play cat and mouse because the API is clearly still there. This happened yesterday for about an hour-ish until our client id was accepted again. Using Twitch's own client id solves this problem but is a "hack-ish" solution.
*410 (Gone), not 401 (Authorization Required)
I suspected that this issue might be relevant (Twitch sometimes interprets API urls without the &api_version=5 query-string as v3 attempts, even with the proper headers), but I'm not sure.
@bastimeyer
You are replacing your own client ID with the one of Twitch's website. You are abusing their system with that change and are probably breaking ToS (not 100% sure).
This is just what streamlink itself does, in the current twitch.py plugin file there is a TWITCH_CLIENT_ID variable set to the old value from @ekimekim's commit. Replacing that value with the newer ID fixed twitch streaming on my end.
Assuming ekimekim's fix is legit and not against TOS or anything like that.
Um.. Forgive me, as I have said I know nothing about programming. How does one actually apply their fix?
I've opened a thread on the Twitch dev forums:
https://discuss.dev.twitch.tv/t/410-gone-when-requesting-access-token-json-api-with-3rd-party-client-id/23060
@Acidifie
No, this is not what Streamlink does. Streamlink uses its own client-id.
kimne78kx3ncx6brgo4mv6wki5h1ko is the client-id of Twitch's website. Using this ID in a 3rd party application is abusing their 3rd party application system.
@gimli520
Go to your streamlink folder, then navigate to pkgsstreamlinkplugins, then open twitch.py in a good text editor (like Notepad++, don't use the default windows notepad as it may break newlines)
Search for pwkzresl8kj2rdj6g7bvxl9ys1wly3j and replace it with kimne78kx3ncx6brgo4mv6wki5h1ko
@bastimeyer
Yet if you check the current version of the twitch.py plugin file it uses the ID pwkzresl8kj2rdj6g7bvxl9ys1wly3j which is exactly the same as the one used until today by @ekimekim.
In fact, if my memory serves right, this https://github.com/streamlink/streamlink/pull/241 is exactly the workaround used way back in 2016/2017 when twitch broke anonymous 3rd-party stream playback.
@gimli520
Go to your streamlink folder, then navigate to pkgsstreamlinkplugins, then open twitch.py in a good text editor (like Notepad++, don't use the default windows notepad as it may break newlines)
Search forpwkzresl8kj2rdj6g7bvxl9ys1wly3jand replace it withkimne78kx3ncx6brgo4mv6wki5h1ko@bastimeyer
Yet if you check the current version of the twitch.py plugin file it uses the IDpwkzresl8kj2rdj6g7bvxl9ys1wly3jwhich is exactly the same as the one used by @ekimekim.
In fact, if my memory serves right, this #241 is exactly the workaround used way back in 2016/2017 when twitch broke anonymous 3rd-party stream playback.
Regardless if the client id provided in source was a work-around we have been using 3rd party client ids for years now with success. It's just within the last 2 days they have started to block 3rd party client ids on this API. Now it seems that only twitch's own client id will work.
just made an account to give ya'll my appreciation for trying to figure out this issue. I love streamlink and I am unfortunetly not as talented in these arts as you guys so I am just quietly watching and monitoring... hoping someone with a bright mind fixes this.
@bastimeyer you're a trooper, thanks for your answers and knowledge!
Where does the client id introduced by #241 comes from? Maybe it is expired or something.
The clientId works fine, as you can still use it to do Helix getstreams or whatever.
pwkzresl8kj2rdj6g7bvxl9ys1wly3j is the client id registered by @gravyboat (#241, #574). Everyone else who is using it in their own application is clearly stealing it. Not a surprise though.
And no, it is not expired, otherwise you wouldn't be able to access the /kraken or /helix APIs, or other client-ids would still be working, which they are not. Btw, if you're using Streamlink Twitch GUI, it always overrides Streamlink's client-id with its own.
Thanks for the clarification @bastimeyer
For whatever reason, youtube-dl is also able to successfully grab the m3u8 playlists of Twitch streams. I'm not sure what method it uses, but it didn't require updating. The version I'm using is nearly 2 months old.
@bastimeyer
Huh, i stand corrected, my bad.
Not sure about the GUI part though, i'm using it and i could not start any streams until i modified the client ID from streamlink's twitch plugin.
I have replaced TWITCH_CLIENT_ID = "pwkzresl8kj2rdj6g7bvxl9ys1wly3j" with TWITCH_CLIENT_ID = os.environ['TWITCH_CLIENT_ID'] in my version of streamlink so I can use my own registered client ID.
If the client id provided in twitch.py is not intended to be used, I would suggest removing it from the repo and/or providing an easy way to provide a different client ID when using the library.
@synap5e It is intended to be used otherwise every user would have to register their own application. It's from our registered application on the streamlink account on Twitch. We're using it like any other developer would.
@dojima
Youtube-dl uses twitch id https://github.com/ytdl-org/youtube-dl/blob/bc48773ed4c068adfe67078714814035660e5ca4/youtube_dl/extractor/twitch.py#L41
@bastimeyer Did you already try the suggestion from here: https://discuss.dev.twitch.tv/t/410-gone-on-v5-games-top/22835/6 on your curl to see if passing &api_version=5 at the end of the request generates the same 410 error?
Doesn't work. The parameters are just a fallback when no headers are set.
@bastimeyer I know it's just a fallback but the person from that post was setting theirs in the header and still had to specify the API version value for their request to work properly. This still seems like an API issue to me.
The API being used is undocumented, I don't think it was ever intended to be used by 3rd parties despite 3rd party client ids working for years.
@dontwatchme We're aware of that, unfortunately there is no alternative that Twitch has provided. @bastimeyer has already provided a response to that on the Twitch issue: https://discuss.dev.twitch.tv/t/410-gone-when-requesting-access-token-json-api-with-3rd-party-client-id/23060
https://dev.twitch.tv/docs/v5/
im pretty sure it says quite clearly some details about prior/new cutoff dates
and this has been talked about possibly eventually occuring
v5 is now in effect?
This has nothing to do with v3 or v5 of the /kraken API, or the new /helix API. This issue is related to the /api/channels/CHANNEL/access_token.json endpoint, which is part of their private, undocumented API (/api).
ah, got you.
since its an authorization service i doubt they want to talk about it.
i did try the other client_id and it still fails.
guess its back to the browser for a few days
good luck coders/developers!
ah, got you.
since its an authorization service i doubt they want to talk about it.i did try the other client_id and it still fails.
guess its back to the browser for a few days
good luck coders/developers!
It didn't work for me too, but I then removed my oauth token from the launch parameters and it's now working.
I got it working with a valid oauth token as well, in that case you don't need a Client-ID or it literally doesn't matter which one is set, as the oauth token seems to take priority. You only get such a token if you are logged in, it seems to be an user token. Since it probably expires and I'm not sure how to obtain one right now besides using the website, the twitch client-id still seems like the safest bet.
But it could get changed periodically soon, which will make it quite annoying to maintain :/ Seems quite deliberate to shut out 3rd parties
I got it working with a valid oauth token as well, in that case you don't need a Client-ID or it literally doesn't matter which one is set, as the oauth token seems to take priority. You only get such a token if you are logged in, it seems to be an user token. Since it probably expires and I'm not sure how to obtain one right now besides using the website, the twitch client-id still seems like the safest bet.
But it could get changed periodically soon, which will make it quite annoying to maintain :/ Seems quite deliberate to shut out 3rd parties
Did not work for me even with a valid token
I got it working with a valid oauth token as well, in that case you don't need a Client-ID or it literally doesn't matter which one is set, as the oauth token seems to take priority. You only get such a token if you are logged in, it seems to be an user token. Since it probably expires and I'm not sure how to obtain one right now besides using the website, the twitch client-id still seems like the safest bet.
But it could get changed periodically soon, which will make it quite annoying to maintain :/ Seems quite deliberate to shut out 3rd partiesDid not work for me even with a valid token
In my case I used my existing 3rd party Client-ID, no accept header like beforehand and just the oauth_token= query parameter. The token I used was of my personal twitch.tv account. You can find it by opening twitch in your browser and inspecting the request cookies for the front page HTML request. It's under the auth-token field. You need to be logged in to twitch for this
Logged out of out Streamlink and tried to log back in to get a new OAuth Token but getting a 401 {"status":401,"message":"invalid csrf token"}?? *Edit after clicking authorize on the Twitch Permissions page
Just making sure its not specific to Streamlink cause the access_token url works with my oauth from the twitch website minus the client_id as @dragonbane0 mentioned.
*Edit never mind, was able to auth in a different browser and still have the same error with the new token
Using an OAuth token from the Twitch website is essentially the same as using the client-id of their website. As an individual user, you can grab your OAuth token from the Twitch website (check the network tab in your browser's dev tools) and use it in Streamlink's --twitch-oauth-token parameter. This should work just fine.
Streamlink however should not be switching from its own client-id to the one of Twitch's website for people who are not signed in with their Twitch account. This is also problematic in regards to the OAuth logins, since the return URL when authenticating is tied to the client-id and users wouldn't be able to use Streamlink's Twitch login function.
@gimli520
Go to your streamlink folder, then navigate to pkgsstreamlinkplugins, then open twitch.py in a good text editor (like Notepad++, don't use the default windows notepad as it may break newlines)
Search forpwkzresl8kj2rdj6g7bvxl9ys1wly3jand replace it withkimne78kx3ncx6brgo4mv6wki5h1ko@bastimeyer
Yet if you check the current version of the twitch.py plugin file it uses the IDpwkzresl8kj2rdj6g7bvxl9ys1wly3jwhich is exactly the same as the one used until today by @ekimekim.
In fact, if my memory serves right, this #241 is exactly the workaround used way back in 2016/2017 when twitch broke anonymous 3rd-party stream playback.
Didn't work for me, thanks anyways
What about just an argument/parameter for our own client id?
when is this going to be fixed?
its annoying, had a stream open, and now I cant launch anything anymore.
If you are using streamlink gui unchecking this box let me open streams again https://i.imgur.com/f7HOoc5.png
@Nepturian We don't have a timeline, it's still undetermined if this is an issue on our end or something Twitch has done. Please have some patience as we're all volunteers dedicating our free time and energy to this project unpaid.
If you are using streamlink gui unchecking this box let me open streams again https://i.imgur.com/f7HOoc5.png
unchecking the box signs you in anonymously
which has no effect.
If you are using streamlink gui unchecking this box let me open streams again https://i.imgur.com/f7HOoc5.png
Thanks, that fixed it for me!
Launching with ./streamlink.exe --twitch-oauth-token YOUR_TOKEN works fine over here.
streamlink version:
1.1.1+dfsg-1
streamlink-twitch-gui version:
1.8.1
I would like to very kindly remind everyone to keep the commenting to a minimum, as mentioned here earlier:
https://github.com/streamlink/streamlink/issues/2680#issuecomment-550468209
It is already way too much spam. I don't want to lock the thread since the issue is not solved, but if the thread keeps growing like this, we will have to at some point. If you want to get notified on any updates, please use the subscribe thread button or the watch repository button. Thanks!
And to get back to the issue, we are fully aware of the problem, but unfortunately, there is currently no proper solution, as it's an issue/change on Twitch's end which we have no control over. Other 3rd party applications are also affected by this, so this is not a Streamlink issue alone.
I've edited this post and made the workaround guide a bit more clear
--twitch-oauth-token parameter, as it will take precedence over the sent client-id, and depending on the origin of your OAuth token, it won't work.plugins/twitch.py), which depends on your Streamlink installation path. If you don't know or if are not sure, use option 2 instead.pwkzresl8kj2rdj6g7bvxl9ys1wly3j, which is Streamlink's client-id, and replace it with kimne78kx3ncx6brgo4mv6wki5h1ko, which is Twitch's client-id.--twitch-oauth-token parameter, which won't work.gql.twitch.tv or api.twitch.tv and select one of the network requestsAuthorization request header and copy the token value (ignore the OAuth part)--twitch-oauth-token=VALUE parameter. Add this parameter to Streamlink's config file, if you don't want to set it each time from the CLI.By using these workarounds, you will be using the client-id of Twitch's website (or an OAuth token which is tied to it) instead of using the one Streamlink has registered and is providing. As 3rd party app developers, we are not supposed to use this client-id, as it's not our own, but as an individual user of this application, you are free to use whatever client-id / OAuth token you like.
As I wrote before some third party app was working, I didn't understand way but I manage to make a test and find something very odd.
On Java on a android app is possible to get the stream token and sig json without any header so without Client-ID
I don't know how this works yet but I just did a simple test with a new function that I created and it just works here is the sample
https://github.com/fgl27/SmartTwitchTV/commit/0584b9daa2e88f4b7546eb5d6d9dcb1d5d413ac6
the fun readUrlHLS receives only a context and the url noting else and it returns the json object just like the other http get from JavaScript function but for some reason without any header just the url link.
that fun readUrlHLS uses this api https://github.com/koush/ion
I know this may sound odd but I'm sure that this no Client-ID is working.
Is very late for me now, so I will not do much test today, if the problem persist tomorrow I will do further test and try to understand why this method on Java works and the old way doesn't.
class TwitchAPI(object):
def __init__(self, session, beta=False, version=5): changed version from 3 to 5
as well as kimne78kx3ncx6brgo4mv6wki5h1ko is what I switched my TWITCH_CLIENT_ID to in twitch.py in the plugins folder, it seems your client ID isn't setup for V5 of the API? it forces V3 response when using your client_id, these two changes worked, and I registered my own private client ID and it works too, maybe get a new client ID for the app? hope this helps. TY for all that you guys do! <3
-Edit: I should mention I use this with Chatty
lass TwitchAPI(object):
def init(self, session, beta=False, version=5): changed version from 3 to 5as well as kimne78kx3ncx6brgo4mv6wki5h1ko is what I switched my TWITCH_CLIENT_ID
Can confirm this worked for me for now.
@gravyboat Dev of Twitch Leecher here... my inbox is also exploding with this issue. I already had it 2 days ago and it solved itself farely quickly. Changing a running and documented API would be a horror scenario for Twitch and all connected devs, so this is probably just a temporary issue. No promises, but I suggest patience.
btw. I am using v5 currently
I would like to very kindly remind everyone to keep the commenting to a minimum, as mentioned here earlier:
#2680 (comment)
It is already way too much spam. I don't want to lock the threads since the issue is not solved, but if the thread keeps growing like this, we will have to at some point. If you want to get notified on any updates, please use the subscribe thread button or the watch repository button. Thanks!And to get back to the issue, we are fully aware of the problem, but unfortunately, there is currently no proper solution, as it's an issue/change on Twitch's end which we have no control over. Other 3rd party applications are also affected by this, so this is not a Streamlink issue alone.
If you want to make it work again as a temporary solution/workaround, you have two options:
- Don't use a Twitch OAuth token and replace Streamlink's client-id with the one of Twitch's website. This will require you to make changes to Streamlink's twitch plugin file. The instructions have been posted several times now in this thread.
- Login in on the Twitch website and get your OAuth token from the browser's dev tools (you can apply filters in the network tab) and use it in Streamlink via
--twitch-oauth-token=TOKEN. If you're using the Twitch GUI, you will have to disable login sharing in the streaming menu, as it will override this parameter if checked, and then set this custom parameter on your own, either in the streaming menu, or in your Streamlink config file.By using these workarounds, you will be using the client-id of Twitch's website (or an OAuth token which is tied to it) instead of using the one Streamlink has registered and is providing. As 3rd party app developers, we are not supposed to use this client-id, as it's not our own, but as an individual user of this application, you are free to use whatever client-id / OAuth token you like.
i tried both of these things in streamlink cli and streamlink-twitch-gui
Found matching plugin twitch API410 for URL twitch.tv/gogcom
Unable to open URL: https://api.twitch.tv/api/channels/gogcom/access_token.json (410 Client Error: Gone for url: https://api.twitch.tv/api/channels/gogcom/access_token.json?as3=t&platform=_)
Waiting for streams, retrying every 2.0 second(s)
ive exited and killall streamlink(-twitch-gui)
/usr/lib/python3/dist-packages/streamlink/plugins/twitch.py
....... nothing changes ........
This is how I got it working on the kodi plugin, might help in debugging (the last sentence is my educated guess as to what happened).
I had to remove my existing auth-token, then change the client ID to the twitch website one, then pull the new auth-token from the website manually (not use the built in request-auth-token function). If I did not remove my existing auth token the change in the client ID would be rejected (probably because the token was associated with the v3 api?)
To me it looks like client IDs and tokens associated with the v3 api are what are not working.
I decided to try something that FeartheBeard mentioned. I did what they did def init(self, session, beta=False, version=5): changed version from 3 to 5
Since then it has been working and I am using the original client ID pwkzresl8kj2rdj6g7bvxl9ys1wly3j as well. It has been working fine and I am able to start streams like normal.
I am unsure if whatever was going on has "fixed" itself on twitches end like it did yesterday, or if Beard's fix is working. If it is Beard's fix, then it def seems like API 3 is the problem. Could also been it is something on both Streamlink and Twitches end respectively. Take what I say with a grain of salt.
The only thing that seems to make this API work for me is using Twitch's client ID; none of the url params or headers seem to make a difference other than the client ID.
The only way this request works is with the Twitch client ID:
curl -sL "https://api.twitch.tv/api/channels/somechannel/access_token?oath_token=undefined&need_https=true&platform=_&player_type=site&player_backend=mediaplayer" -H 'Accept: application/vnd.twitchtv.v5+json' -H 'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko'
My guess would be either they've implemented something that blocks all IDs other than the client ID used for their website, that broke for a little while, and is now fixed, or this API is just being half broken in general right now.
:EDIT:
You can click these links in your browser to check what's working for you...
Streamlink's client ID:
https://api.twitch.tv/api/channels/dansgaming/access_token.json?client_id=pwkzresl8kj2rdj6g7bvxl9ys1wly3j
Twitch's client ID:
https://api.twitch.tv/api/channels/dansgaming/access_token.json?client_id=kimne78kx3ncx6brgo4mv6wki5h1ko
On my end, anything other than Twitch's client ID = 410 Gone.
It seems to be working again without any changes on my part.
It seems it was a problem on twitch's side as I did nothing and everything seems to be working again
Everything does indeed seem to work again. Twitch developer support doesn't seem too sympathetic though. In the interest of applying the client id solution to streamlink-gui should this happen again in the near future, does anyone knowledgeable know where the gui's client id is coded?
@timothystewart6 that's for streamlink only. Earlier @bastimeyer said there was a separate one for his streamlink-gui: "Btw, if you're using Streamlink Twitch GUI, it always overrides Streamlink's client-id with its own." Can't seem to find that client id to change it.
Twitch developer support doesn't seem too sympathetic though
Take a look at the responses from the moderators on the dev forums thread I've opened:
https://discuss.dev.twitch.tv/t/410-gone-when-requesting-access-token-json-api-with-3rd-party-client-id/23060
does anyone knowledgeable know where the gui's client id is coded
https://github.com/streamlink/streamlink-twitch-gui/blob/v1.8.1/src/config/twitch.json#L17
This won't help you though, because what I've said in regards to overriding the client-id doesn't work unfortunately:
https://github.com/streamlink/streamlink/pull/2686#issuecomment-552019120
They're super helpful. Thanks Twitch!
The person who is responding isn't twitch staff as far as I know, just a 3rd party developer who offers support.
Really, I'm surprised they haven't locked it yet. Any mention of this API I've seen posted there usually gets closed pretty quickly lol.
I can kind of see where they're coming from, though. This API could be abused fairly easily by view botters and probably loses them a fair amount of revenue from not showing ads (I know they can slip them in the stream now, but I very rarey get them).
I've had no issues with streamlink, then again I haven't used the default client-id in a long, long time.. Mostly because I expected Twitch would eventually kill it.
The API endpoint for twitch has however changed quite a bit lately, bouncing between fastly and akamai. Not saying twitch isn't trying to deprecate v5 or cracking down on botters but it's also possible the errors are unrelated.
Applications are _supposed to_ register for their own ID's. Kraken is dead simple, Helix is a pita and not fully implemented anyway.
yep, working as expected again. It almost looks like Twitch is trying out stuff. But to what end?
Seems to work again yes, but Twitch is most likely changing their API to circumvent this ''skip ad'' it seems.
Since someone on the Twitch dev forum asked, I created a request on Twitch's uservoice https://twitch.uservoice.com/forums/310213-developers/suggestions/38997565-documented-api-for-streams-and-vods
That moderator obviously has no clue what they're even talking about. They keep claiming that undocumented = unsupported even though Twitch could very easily remove our ability to use this endpoint with our client IDs if it was truely unsupported.
even though Twitch could very easily remove our ability to use this endpoint with our client IDs if it was truely unsupported.
"Unsupported" doesn't mean "we forbid us to use it", it means "we provide no support on it, and we will do with it whatever we feel like and whenever we feel like, and it's not our concern if it breaks something for you, we warned you". If only they provided any supported alternative for the streams and VODs, it wouldn't be so frustrating...
even though Twitch could very easily remove our ability to use this endpoint with our client IDs if it was truely unsupported.
If only they provided any _supported_ alternative for the streams and VODs, it wouldn't be so frustrating...
Who is stopping you to use the webplayer? KEKW
Which is the ONLY way to embed a player into your app or website, without braking the TOS.
@S0und The web player is bloated, slow, leaks memory like there's no tomorrow and takes 60% of my laptop's CPU to run a damn 720p video stream (where VLC needs 3%, for reference). So, there's that.
Also, the web player is not the topic of this thread.
@S0und The web player is bloated, slow, leaks memory like there's no tomorrow and takes 60% of my laptop's CPU to run a damn 720p video stream (where VLC needs 3%, for reference). So, there's that.
Also, the web player is not the topic of this thread.
@Tomalak
You don't have to lecture me, i'm fully aware of that, but that's the "supported alternative".
@S0und
OK, I didn't think that needed to be mentioned explicitly on GitHub, but I was talking about the API alternative, not an alternative for end-user product.
They did it again, same error again :(
Same here
It is still working for me. Try doing this in the Twitch.py file. Go here
def init(self, session, beta=False, version=5) and if it says version 3, change it to 5, save it and then try again. It should work. if it already says 5 and the problem is happening, well then we seem to have another puzzle piece to work through.
Before this ends up in another flood of posts, I'm going to lock this thread.
We've already said and commented on everything regarding this issue and I don't think there won't be any more comments with more useful information.
See this comment here if you're looking for a temporary workaround solution:
https://github.com/streamlink/streamlink/issues/2680#issuecomment-552024753
If you need help or want to discuss the Twitch API situation, feel free to use the Streamlink Gitter channel:
https://gitter.im/streamlink/streamlink
And in case that these issues will continue, we will probably have to go the dirty way and use Twitch's own client-id for all private API requests in the future. I fear there won't be any other solution, but hopefully I'm wrong.
@gimli520
This is not true. The version=3 parameter is the old default parameter value, but it's not being used. version=5 gets explicitly set when the class instance gets initialized. The issue is also not part of the kraken API anyway which the version number is used for, so it's completely irrelevant.
Streamlink 1.3.0 has been released today with the fixed Twitch.tv plugin (fixed in PR #2692).
Apologies for taking a bit longer, but as you all know, Twitch went back and forth with the API changes several times throughout the past two weeks and it wasn't 100% clear whether it was an intentional change or not, especially because of the lack of proper replies on Twitch's dev forums.
Let me quickly recap the whole thing and point out what has changed.
The issue
A little bit more than two weeks ago, Twitch had started to restrict access to their old private API namespace and a 410 Client Error: Gone for url error was returned when requesting those endpoints, like for example when requesting a streaming access token, which Streamlink has to do before it can launch Twitch streams. Not just Streamlink, but all third party Twitch applications were affected by this.
The Twitch API situation
Twitch officially provides two API namespaces, /kraken, the old and deprecated namespace with v5 as the current version (v3 has been shut down this year), and /helix, the *new* and rate-limited, and also still feature-limited namespace (different issue). Both of these API namespaces unfortuantely do not provide the necessary endpoints for retrieving essential data like an access token needed for watching streams, or reading other data like followed games/categories, etc. That is why Streamlink and Streamlink Twitch GUI needed to access a third, private Twitch API namespace, /api, which is not intended for 3rd party app developers.
This private API namespace was used on Twitch's old website mainly for hidden and for newly added features or experiments. However, when Twitch redesigned their website one and a half years ago or so, they also introduced a fourth API, based on a different tech (GraphQL). This new GQL API is private and exclusive to their website as well and has replaced almost all of the old API requests they make on their website. One of the few exceptions is the streaming access token, which still lives on the old private API namespace.
Client-IDs
In order to access any of these APIs, developers of third party applications need to register an application name with their Twitch account. In return, they receive a public client-id, which needs to be sent with each API request. The Twitch website is no exception to this and thus also uses its own client-id to make API requests. This client-id is public as well, like every other client-id.
To come back to the problem, what has changed is how Twitch reacts to private API calls with third party client-ids. Instead of allowing third party applications to access the private API namespace, they now have started to restrict access to it, so only their own client-id can be used. The reasons for this are unknown, and we probably won't ever know, but it could be related to the API changes of their new website which I just talked about, or other things like a new view-botting prevention, etc.
OAuth tokens
Another issue are API requests which require or where you can optionally add authentication data with a so called OAuth token. An OAuth token is a login key generated by Twitch after a user has successfully logged in on their website or a third party application which requested authorization. The token is not just tied to the user, but also to the application's client-id. Since some of the private API endpoints require authentication data, OAuth tokens generated from third party client-ids can't be used anymore.
The only alternative for making requests with authentication data on the changed private API namespace is using an OAuth token which was generated by Twitch's website. However, automatically reading this token with Streamlink or Streamlink Twitch GUI is not possible, since this information is stored by the web browser. Asking the user to manually copy the token is impractical and not suited for applications like Streamlink.
Fixing the issue
Since the private /api namespace was never officially supported by Twitch, they don't care if restricting access or making changes to it will break third party applications which rely on it. This is all fine by them and nothing we can complain about, but what's unfortunate about this is that there are no alternatives available. Even though Twitch offers a feature request forum where API features can be asked for, I doubt that an official API endpoint for getting a streaming access token will ever be added by them. The other features are not relevant to Streamlink. For Streamlink Twitch GUI however, they are, but that's not the topic of this thread.
This means that the only solution for fixing this issue was making Streamlink use Twitch's own client-id for private API namespace requests and removing those features which require auth data on the private API. We are aware that this probably violates their developer ToS, but as I've said, there's nothing else which could have been done instead. And yes, we know that other big applications are also using Twitch's client-id, but this doesn't mean that it's the right way.
Also, since there's no definitive way of determining the origin of an OAuth token (Twitch's website or a third party application), the authentication data had to be removed when requesting a streaming access token. This means that with these changes, trying to log in to your Twitch account with Streamlink 1.3.0 won't do anything except logging your user name to the output. While watching streams with your provided OAuth token, you won't be able to receive in-game item drops anymore (if you've linked any games on the Twitch website to your account) and you also won't be able to access restricted streams/VODs anymore. We didn't remove the --twitch-oauth-token and --twitch-oauth-authenticate parameters though, as we didn't want to introduce breaking changes, so please be aware of that.
Most helpful comment
I would like to very kindly remind everyone to keep the commenting to a minimum, as mentioned here earlier:
https://github.com/streamlink/streamlink/issues/2680#issuecomment-550468209
It is already way too much spam. I don't want to lock the thread since the issue is not solved, but if the thread keeps growing like this, we will have to at some point. If you want to get notified on any updates, please use the subscribe thread button or the watch repository button. Thanks!
And to get back to the issue, we are fully aware of the problem, but unfortunately, there is currently no proper solution, as it's an issue/change on Twitch's end which we have no control over. Other 3rd party applications are also affected by this, so this is not a Streamlink issue alone.
https://discuss.dev.twitch.tv/t/410-gone-when-requesting-access-token-json-api-with-3rd-party-client-id/23060
If you want to make it work again as a temporary solution/workaround, you have two options
I've edited this post and made the workaround guide a bit more clear
--twitch-oauth-tokenparameter, as it will take precedence over the sent client-id, and depending on the origin of your OAuth token, it won't work.plugins/twitch.py), which depends on your Streamlink installation path. If you don't know or if are not sure, use option 2 instead.pwkzresl8kj2rdj6g7bvxl9ys1wly3j, which is Streamlink's client-id, and replace it withkimne78kx3ncx6brgo4mv6wki5h1ko, which is Twitch's client-id.--twitch-oauth-tokenparameter, which won't work.gql.twitch.tvorapi.twitch.tvand select one of the network requestsAuthorizationrequest header and copy the token value (ignore theOAuthpart)--twitch-oauth-token=VALUEparameter. Add this parameter to Streamlink's config file, if you don't want to set it each time from the CLI.By using these workarounds, you will be using the client-id of Twitch's website (or an OAuth token which is tied to it) instead of using the one Streamlink has registered and is providing. As 3rd party app developers, we are not supposed to use this client-id, as it's not our own, but as an individual user of this application, you are free to use whatever client-id / OAuth token you like.