tonycpsu / streamglob

A console media browser designed to facilitate live and time-shifted viewing of online content.
GNU General Public License v3.0
34 stars 10 forks source link

MLB Authentication Failure #67

Open dyep49 opened 1 month ago

dyep49 commented 1 month ago

I use streamglob to download MLB videos.

The following command for example

streamglob download://mlb/07-19-2024.SF.1:offset=9352

Sometime around the all star game (July 16), I started receiving the following error

2024-07-21 14:29:40.745 streamglob.providers [        __init__:90  ] [    info] loading providers
2024-07-21 14:29:40.999 streamglob.providers [            base:223 ] [    info] provider instagram initialized
2024-07-21 14:29:40.1000 streamglob.providers [            base:223 ] [    info] provider mlb initialized
2024-07-21 14:29:40.1000 streamglob.providers [            base:223 ] [    info] provider nhl initialized
2024-07-21 14:29:41.000 streamglob.providers [            base:223 ] [    info] provider rss initialized
2024-07-21 14:29:41.001 streamglob.providers [            base:223 ] [    info] provider scraper initialized
2024-07-21 14:29:41.001 streamglob.providers [            base:223 ] [    info] provider youtube initialized
2024-07-21 14:29:41.001 streamglob.scrapers  [        __init__:28  ] [    info] loading scrapers
2024-07-21 14:29:41.001 streamglob.scrapers  [        __init__:32  ] [    info] loading scraper: Simple
2024-07-21 14:29:41.001 streamglob.model     [           model:1261] [    info] initializing data model
2024-07-21 14:29:41.016 streamglob.providers [            base:448 ] [    info] provider instagram initializing view
2024-07-21 14:29:41.040 streamglob.providers [            base:448 ] [    info] provider rss initializing view
2024-07-21 14:29:41.045 streamglob.providers [            base:448 ] [    info] provider scraper initializing view
2024-07-21 14:29:41.045 streamglob.providers [            base:448 ] [    info] provider youtube initializing view
2024-07-21 14:29:41.571 streamglob.providers [            base:448 ] [    info] provider mlb initializing view
2024-07-21 14:29:41.987 streamglob.providers [        __main__:483 ] [    info] running in command line mode
Traceback (most recent call last):
  File "/usr/local/bin/streamglob", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/streamglob/__main__.py", line 608, in main
    rc = run_cli(action, provider, selection, **opts)
  File "/usr/local/lib/python3.8/dist-packages/streamglob/__main__.py", line 505, in run_cli
    state.event_loop.run_until_complete(run_tasks(tasks))
  File "/usr/local/lib/python3.8/dist-packages/nest_asyncio.py", line 90, in run_until_complete
    return f.result()
  File "/usr/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/usr/lib/python3.8/asyncio/tasks.py", line 280, in __step
    result = coro.send(None)
  File "/usr/local/lib/python3.8/dist-packages/streamglob/__main__.py", line 474, in run_tasks
    async for task in tasks:
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/base.py", line 590, in download
    for task in self.create_download_tasks(listing, index=index, **kwargs):
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/widgets.py", line 309, in create_download_tasks
    sources, kwargs = self.extract_sources(listing, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/base.py", line 664, in extract_sources
    sources, kwargs = self.play_args(listing, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/bam.py", line 2321, in play_args
    kwargs["headers"] = self.session.headers
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/mlb.py", line 437, in headers
    "Authorization": self.access_token
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/mlb.py", line 535, in access_token
    self.refresh_access_token()
  File "/usr/local/lib/python3.8/dist-packages/streamglob/providers/mlb.py", line 686, in refresh_access_token
    DEVICE_ID = session_response["device"]["id"]
KeyError: 'device'

I logged the session_response variable (https://github.com/tonycpsu/streamglob/blob/main/streamglob/providers/mlb.py#L678) and received the following output:

{'errors': [{'code': 'access-token.invalid', 'description': 'auth.bad-partner'}]}

I've tested this on two computers and tried deleting the mlb.session and mlb.cookies files created by streamglob, but that didn't change anything.

dyep49 commented 1 month ago

Looks like there are API changes that have broken other MLBtv projects

https://github.com/tonywagner/mlbserver/issues/44