-
Notifications
You must be signed in to change notification settings - Fork 25
Exception: could not authenticate: {authz_contet} #70
Comments
That is just a generic authentication error. In this case, I think it is because the authentication type changed from token to “code” which will require some updates to handle. |
Thanks, Tony. Glad to see you're still around! Let me know if I can assist. This one is pretty deep in your core code and I knew I wasn't going to be able to fix it even if I understood why it failed. I'm guessing the issue is in obtaining the initial URL to begin the stream, but I seem to remember there is a need to keep authenticating even after that. Is there is any hack-workaround to get a downloadable stream going or will it require learning their new dance? |
I'm completely locked out of mlb.tv subscriptions for watching my team (Blue Jays are blacked out across Canada), so I'm pretty much done with this project. I'll likely be archiving this repo soon... If anyone want's to take it over that would be great. |
I downloaded the Padres-Cubs using streamlink. It takes some elbow grease using dev tools (F12) Open the stream you want and hit F12 to open dev tools. You might have to reload the stream if it starts playing before you hit F12. Also open notepad to paste these things and then copy the entire string into a command line window. You want to retrieve two strings from dev tools, the authorization key (type "keys" into the search box) and the m3u link (type "m3u" into the search box) For the authorization key, click on the XHR file and scroll down on the right to the authorization key, a very long string of jumbled letters and numbers. Right click on that to copy and paste it into the code listed below. Then find the m3u link you want, right click>copy and paste that into the code below. These will all go on one line in the console window: streamlink -o "2023-03-03-SD-CHC.ts" If the stream is live already and you want to back up to the beginning to download, insert --hls-start-offset HH:MM:SS or --hls-live-restart Also make sure you CD to the directory you want to download into before you start streamlink |
kidshare, those are some great steps you've provided us, and I decided to follow what you've set out. One snag, maybe you can help? I keep getting "Could not open stream" errors. Maybe it has something to do with the m3u file I'm choosing. Which would you suggest be the one I'd want? There seem to be several m3u links that appear almost identical. |
I used the stream that starts with "master." Maybe you started a little early? I got the same error message till just before the Padres game even though I could see the "Event will start shortly" screen. Doing it this way seems to skip commercials so I think you have to wait for the actual game stream to start. |
The comment above is correct. The MLB oauth2 authorize endpoint that takes a STATE and NONCE and SESSION TOKEN now no longer returns "data.access_token" as it used to. It returns "data.code" which needs to be used in an additional step now. I have a PHP app that was built using this python app as an example so when it broke today I thought about checking to see if mlbv was working and it seems to be broken in the same way. I don't know python very well but here is the PHP code I'm using now that is working again that should be enough to show you how to fix mlbv. We need two strings now, a code_verifier and a code_challenge. I generate a code_verifier just like I generate my state and nonce, a random 58 character URL safe string. I generate the code_challenge by base 64 encoding a sha256 hashed version of the code_verifier using an example from this site: https://www.oauth.com/oauth2-servers/pkce/authorization-request/
Example code_verifier: 7dfa3871146d1b2a002b59926458c7b098def154cd6
This returns a "data.code" value we'll use in the next endpoint.
This will return a JSON response containing the access_token and the rest of the app remains the same. Hopefully this helps. |
I may attempt to create a PR if I can get mlbv running locally again but I can't make any promises. |
Alright, I submitted a PR for consideration. |
File "c:\computer\python395\lib\site-packages\mlbv\mlbam\mlbsession.py", line 76, in init |
If you want to use the patched version before it's merged, you'll need to clone the repo, checkout the patch branch, and install it from the project root directory.
|
This error started a day or so ago. Until then everything was working perfectly. Now I consistently get the following error:
File "c:\program files\python37\lib\site-packages\mlbv\mlbam\mlbsession.py", line 183, in get_okta_token
raise Exception("could not authenticate: {authz_contet}")
Exception: could not authenticate: {authz_contet}
I could include the rest of the trace stack if needed. I have seen that this issues was raised in the streamglob hub (https://github.com/tonycpsu/streamglob/issues), but the user indicated that the problem magically disappeared so there was no solution as such.
If anyone has any ideas I would like to begin downloading baseball again.
The text was updated successfully, but these errors were encountered: