christopher-dG / gpymusic

Google Py Music: A simple TUI client for Google Play Music
MIT License
200 stars 13 forks source link

Api issues (it seems) #18

Closed plumps closed 7 years ago

plumps commented 7 years ago

I am on a paid account (albeit in trial mode). Activated the login with oauth. No matter which song I try to play, it crashes.

system: macOs sierra, python 3.6.0

File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 218, in perform
response.raise_for_status()
File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/requests/models.py", line 909, in raise_for_status
                                                 raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1488809739061&sig=KRSB9QoLLes7vYyWJO54qW4pHzE&mjck=T3mam5ah6ne36nued4puyhqyapy&hl=en_US&dv=0&tier=aa
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pmcli", line 28, in <module>
client.transition()
File "/Users/plumps/.local/share/pmcli/src/client.py", line 51, in transition
commands[command](arg)
File "/Users/plumps/.local/share/pmcli/src/client.py", line 281, in play
item.play()
File "/Users/plumps/.local/share/pmcli/src/music_objects.py", line 224, in play
MusicObject.play(self['songs'])
File "/Users/plumps/.local/share/pmcli/src/music_objects.py", line 50, in play
url = common.mc.get_stream_url(song['id'])
File "<decorator-gen-102>", line 2, in get_stream_url
File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/gmusicapi/utils/utils.py", line 293, in wrapper
return function(*args, **kw)
File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 371, in get_stream_url
                                                               return self._make_call(mobileclient.GetStreamUrl, song_id, device_id, quality)
File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/gmusicapi/clients/shared.py", line 84, in _make_call
                                                                 return protocol.perform(self.session, self.validate, *args, **kwargs)
File "/Users/plumps/.pyenv/versions/pmcli/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 226, in perform
                                                         raise CallFailure(err_msg, call_name)
gmusicapi.exceptions.CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1488809739061&sig=KRSB9QoLLes7vYyWJO54qW4pHzE&mjck=T3mam5ah6ne36nued4puyhqyapy&hl=en_US&dv=0&tier=aa
Now playing: None                                                                                                                              (requests kwargs: {'method': 'GET', 'url': 'https://mclients.googleapis.com/music/mplay', 'allow_redirects': False, 'headers': {'X-Device-ID': '16_seemingly_random_characters', 'Authorization': '<omitted>'}, 'params': {'opt': 'hi', 'net': 'mob', 'pt': 'e', 'slt': '1488809739061', 'sig': b'KRSB9QoLLes7vYyWJO54qW4pHzE', 'mjck': 'T3mam5ah6ne36nued4puyhqyapy', 'hl': 'en_US', 'dv': 0, 'tier': 'aa'}})
                                                                                                                                     (response was: '<HTML>\n<HEAD>\n<TITLE>Forbidden</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Forbidden</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n')
christopher-dG commented 7 years ago

I just tested this by starting the trial on my free account and it works fine for me, you're not the only one to have this issue though.

Are you 100% sure that your device ID is correct?

Does this happen on every song that you try to play, or does it ever work properly?

Also, the OAuth is not necessary unless you have a free account, login for full accounts is done with the config file credentials (not that it's harmful or anything).

Other questions: does this happen when playing songs, artists, or albums, or all three?

plumps commented 7 years ago

oh, my bad, forgot to replace the device ID with something meaningful. Maybe you can replace "16_seemingly_random_characters" with needs_to_be_generated to place an additional hint.

now everything seems to be fine