AngellusMortis / sxm-player

A pluggable SXM music player written in Python
MIT License
30 stars 12 forks source link

Error parsing json response for channels #16

Open oddballracing opened 1 month ago

oddballracing commented 1 month ago

Description

Failed to parse channel listing, although authentication appears successful (auth was failing when i was attempting to use 'US' default region). Encountered the same issue whether installed globally with pip or under v-env with pipx

sxm-player --region CA --username {redacted} --password {redacted}:

2024-10-24 00:06:10 debian sxm_player[2445] INFO Attempting to connect SXM Client (next in 10 seconds) 2024-10-24 00:06:10 debian httpx[2449] INFO HTTP Request: POST https://player.siriusxm.com/rest/v2/experience/modules/modify/authentication "HTTP/1.1 200 OK" 2024-10-24 00:06:10 debian httpx[2449] INFO HTTP Request: POST https://player.siriusxm.com/rest/v2/experience/modules/resume?OAtrial=false "HTTP/1.1 200 OK" 2024-10-24 00:06:10 debian httpx[2449] INFO HTTP Request: GET https://player.siriusxm.com/rest/v2/experience/modules/get/configuration?result-template=html5&app-region=CA&cacheBuster=1729749970 "HTTP/1.1 200 OK" 2024-10-24 00:06:11 debian httpx[2449] INFO HTTP Request: POST https://player.siriusxm.com/rest/v4/experience/modules/get?type=2 "HTTP/1.1 200 OK" 2024-10-24 00:06:11 debian /usr/local/lib/python3.11/dist-packages/sxm/client.py[2449] ERROR Error parsing json response for channels 2024-10-24 00:06:11 debian /usr/local/lib/python3.11/dist-packages/sxm/client.py[2449] ERROR Traceback (most recent call last): File "/usr/local/lib/python3.11/dist-packages/sxm/client.py", line 441, in get_channels channels = data["moduleList"]["modules"][0]["moduleResponse"][


KeyError: 'moduleList'

2024-10-24 00:06:11 debian sxm_player.sxm[2449] INFO sxm has started on http://127.0.0.1:9999
2024-10-24 00:06:11 debian sxm_player[2445] INFO SXM Client started. 0 channels available

#sxm --region CA --username {redacted} --password {redacted} --list-channels:

INFO:httpx:HTTP Request: POST https://player.siriusxm.com/rest/v2/experience/modules/modify/authentication "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://player.siriusxm.com/rest/v2/experience/modules/resume?OAtrial=false "HTTP/1.1 200 OK"
INFO:httpx:HTTP Request: POST https://player.siriusxm.com/rest/v4/experience/modules/get?type=2 "HTTP/1.1 200 OK"
ERROR:/usr/local/lib/python3.11/dist-packages/sxm/client.py:Error parsing json response for channels
ERROR:/usr/local/lib/python3.11/dist-packages/sxm/client.py:Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/sxm/client.py", line 441, in get_channels
    channels = data["moduleList"]["modules"][0]["moduleResponse"][
               ~~~~^^^^^^^^^^^^^^
KeyError: 'moduleList'

╭───────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────────╮
│ /usr/local/lib/python3.11/dist-packages/sxm/cli.py:77 in main                                                                                                                                        │
│                                                                                                                                                                                                      │
│   74 │                                                                                        ╭────────────────────────── locals ──────────────────────────╮                                         │
│   75 │   sxm = SXMClient(username, password, region=region, quality=quality)                  │  do_list = True                                            │                                         │
│   76 │   if do_list:                                                                          │     host = '127.0.0.1'                                     │                                         │
│ ❱ 77 │   │   l1 = max(len(x.id) for x in sxm.channels)                                        │ password = '{redacted}'                                     │                                         │
│   78 │   │   l2 = max(len(str(x.channel_number)) for x in sxm.channels)                       │     port = 9999                                            │                                         │
│   79 │   │   l3 = max(len(x.name) for x in sxm.channels)                                      │ precache = True                                            │                                         │
│   80                                                                                          │  quality = <QualitySize.LARGE_256k: 'LARGE'>               │                                         │
│                                                                                               │   region = <RegionChoice.CA: 'CA'>                         │                                         │
│                                                                                               │      sxm = <sxm.client.SXMClient object at 0x7fc1618695d0> │                                         │
│                                                                                               │ username = '{redacted}'                                     │                                         │
│                                                                                               │  verbose = False                                           │                                         │
│                                                                                               ╰────────────────────────────────────────────────────────────╯                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: max() arg is an empty sequence