Open aplocher opened 6 years ago
You have to find a valid device id and use that
On Sat, May 26, 2018, 7:30 PM Adam Plocher notifications@github.com wrote:
Hello, I had my Echo Dot turned off for the last month or so. I've recently plugged it back in and now when I go to use GeeMusic I'm receiving a 403-forbidden error from Google when it tries to start the stream.
Listing my playlists and other non-song-playing commands seem to work just fine.
Anyone know why? Was there a recent update to the code that I need to grab?
Everything was working fine last time I used it (like a month or so ago), but now it's not working. I last git-pulled and built geemusic I think in February, so it's not too terribly old.
I've pasted the output that I got from Foreman below...
Thank you!
16:25:11 web.1 | 127.0.0.1 - - [26/May/2018 16:25:11] "POST /alexa HTTP/1.0" 200 - 16:25:12 web.1 | 127.0.0.1 - - [26/May/2018 16:25:12] "HEAD /alexa/stream/Tr56ue23f5fe5jmxdkzlkxia4ta HTTP/1.0" 500 - 16:25:12 web.1 | 127.0.0.1 - - [26/May/2018 16:25:12] "GET /alexa/stream/Tr56ue23f5fe5jmxdkzlkxia4ta HTTP/1.0" 500 - 16:25:13 web.1 | Traceback (most recent call last): 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1997, in call 16:25:13 web.1 | return self.wsgi_app(environ, start_response) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app 16:25:13 web.1 | response = self.handle_exception(e) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception 16:25:13 web.1 | reraise(exc_type, exc_value, tb) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise 16:25:13 web.1 | raise value 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app 16:25:13 web.1 | response = self.full_dispatch_request() 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request 16:25:13 web.1 | rv = self.handle_user_exception(e) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception 16:25:13 web.1 | reraise(exc_type, exc_value, tb) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise 16:25:13 web.1 | raise value 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request 16:25:13 web.1 | rv = self.dispatch_request() 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request 16:25:13 web.1 | return self.view_functionsrule.endpoint 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/controllers.py", line 12, in redirect_to_stream 16:25:13 web.1 | stream_url = api.get_google_stream_url(song_id) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/utils/music.py", line 148, in get_google_stream_url 16:25:13 web.1 | return self._api.get_stream_url(song_id) 16:25:13 web.1 | File "
", line 2, in get_stream_url 16:25:13 web.1 | 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/utils/utils.py", line 293, in wrapper 16:25:13 web.1 | return function(*args, *kw) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 388, in get_stream_url 16:25:13 web.1 | return self._make_call(mobileclient.GetStreamUrl, song_id, device_id, quality) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/shared.py", line 84, in _make_call 16:25:13 web.1 | return protocol.perform(self.session, self.validate, args, **kwargs) 16:25:13 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 226, in perform 16:25:13 web.1 | raise CallFailure(err_msg, call_name) 16:25:13 web.1 | gmusicapi.exceptions.CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1527377112170&sig=LEpFLXj_P1hzseOAZKZ6KwrOtM4&mjck=Tr56ue23f5fe5jmxdkzlkxia4ta&hl=en_US&dv=0&tier=aa 16:25:13 web.1 | (requests kwargs: {'method': 'GET', 'url': 'https://mclients.googleapis.com/music/mplay', 'allow_redirects': False, 'headers': {'X-Device-ID': '989096C1DAAD', 'Authorization': ' '}, 'params': {'opt': 'hi', 'net': 'mob', 'pt': 'e', 'slt': '1527377112170', 'sig': b'LEpFLXj_P1hzseOAZKZ6KwrOtM4', 'mjck': 'Tr56ue23f5fe5jmxdkzlkxia4ta', 'hl': 'en_US', 'dv': 0, 'tier': 'aa'}}) 16:25:13 web.1 | (response was: '\n\n Forbidden \n\n\nForbidden
\nError 403
\n\n\n') 16:25:13 web.1 | 127.0.0.1 - - [26/May/2018 16:25:13] "HEAD /alexa/stream/Tr56ue23f5fe5jmxdkzlkxia4ta HTTP/1.0" 500 - 16:25:13 web.1 | 127.0.0.1 - - [26/May/2018 16:25:13] "GET /alexa/stream/Tr56ue23f5fe5jmxdkzlkxia4ta HTTP/1.0" 500 -— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stevenleeg/geemusic/issues/220, or mute the thread https://github.com/notifications/unsubscribe-auth/AJN8OI7GgOH1VflH6NT8IRVyWL2nim_jks5t2eWKgaJpZM4UPFmF .
Sorry - I am fairly new to this and don't have a good python background. I have set this up tp run on Heroku and things were fine until a couple of days ago. Seem to have been experiencing the same "Forbidden" error. Unfortunately, i don't understand the comment about finding a valid device id. Did something change with the google interface? As described above all non-streaming commands work fine. Thanks! Below is the last lines form the Heroku log:
2018-05-27T01:28:01.603306+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/utils/utils.py", line 293, in wrapper
2018-05-27T01:28:01.603309+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 388, in get_stream_url
2018-05-27T01:28:01.603310+00:00 app[web.1]: return self._make_call(mobileclient.GetStreamUrl, song_id, device_id, quality)
2018-05-27T01:28:01.603311+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/clients/shared.py", line 84, in _make_call
2018-05-27T01:28:01.603315+00:00 app[web.1]: return protocol.perform(self.session, self.validate, *args, **kwargs)
2018-05-27T01:28:01.603316+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 226, in perform
2018-05-27T01:28:01.603317+00:00 app[web.1]: raise CallFailure(err_msg, call_name)
2018-05-27T01:28:01.603319+00:00 app[web.1]: gmusicapi.exceptions.CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1527384481495&sig=xJ8iIyYfpfBnMb6-8e87KxTTdtM&mjck=Tkt2j6a6rfpeqpn7sgrkn45k6fu&hl=en_US&dv=0&tier=aa
2018-05-27T01:28:01.603321+00:00 app[web.1]: (requests kwargs: {'method': 'GET', 'url': 'https://mclients.googleapis.com/music/mplay', 'allow_redirects': False, 'headers': {'X-Device-ID': '1640054800FD', 'Authorization': 'Forbidden
\nError 403
\n\n\n')
So they started banning random mac addresses. You have to log into the api via the example login interface on the gmusicapi and use the command I mentioned to grab a mac address that is valid.
On Sat, May 26, 2018, 9:36 PM edjbush notifications@github.com wrote:
Sorry - I am fairly new to this and don't have a good python background. I have set this up tp run on Heroku and things were fine until a couple of days ago. Seem to have been experiencing the same "Forbidden" error. Unfortunately, i don't understand the comment about finding a valid device id. Did something change with the google interface? As described above all non-streaming commands work fine. Thanks! Below is the last lines form the Heroku log:
2018-05-27T01:28:01.603306+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/utils/utils.py", line 293, in wrapper 2018-05-27T01:28:01.603309+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 388, in get_stream_url 2018-05-27T01:28:01.603310+00:00 app[web.1]: return self._make_call(mobileclient.GetStreamUrl, song_id, device_id, quality) 2018-05-27T01:28:01.603311+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/clients/shared.py", line 84, in _make_call 2018-05-27T01:28:01.603315+00:00 app[web.1]: return protocol.perform(self.session, self.validate, *args, **kwargs) 2018-05-27T01:28:01.603316+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gmusicapi/protocol/shared.py", line 226, in perform 2018-05-27T01:28:01.603317+00:00 app[web.1]: raise CallFailure(err_msg, call_name) 2018-05-27T01:28:01.603319+00:00 app[web.1]: gmusicapi.exceptions.CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1527384481495&sig=xJ8iIyYfpfBnMb6-8e87KxTTdtM&mjck=Tkt2j6a6rfpeqpn7sgrkn45k6fu&hl=en_US&dv=0&tier=aa 2018-05-27T01:28:01.603321+00:00 app[web.1]: (requests kwargs: {'method': 'GET', 'url': 'https://mclients.googleapis.com/music/mplay', 'allow_redirects': False, 'headers': {'X-Device-ID': '1640054800FD', 'Authorization': ''}, 'params': {'opt': 'hi', 'net': 'mob', 'pt': 'e', 'slt': '1527384481495', 'sig': b'xJ8iIyYfpfBnMb6-8e87KxTTdtM', 'mjck': 'Tkt2j6a6rfpeqpn7sgrkn45k6fu', 'hl': 'en_US', 'dv': 0, 'tier': 'aa'}}) 2018-05-27T01:28:01.603322+00:00 app[web.1]: (response was: '\n\n
Forbidden \n\n\n Forbidden\nError 403\n\n\n')— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/stevenleeg/geemusic/issues/220#issuecomment-392299083, or mute the thread https://github.com/notifications/unsubscribe-auth/AJN8OHiild6WBvacPsw9yzdGV9fb2wtzks5t2gMggaJpZM4UPFmF .
@fergyfresh thanks, what command are you referring to? I don't see mention of a command.
When I was googling this particular error I did see several folks mention it over in the gmusicapi repo, and the fix was always device-id-related, however as far as I know there's no configurable device-id in geemusic - at least it doesn't mention it in the docs that I've seen.
I did try a new app password, thinking that maybe authenticating for the first time with an app-password (when using 2-factor auth) somehow initialized a device id or something. But that didn't help at all.
@edjbush thanks, glad to know I'm not the only one lol...
Hi guys, I am facing the same issue today
You have to have an ANDROID_ID set. The app password mixed with FROM_MAC_ADDRESS call generates a device id. I'm not at my computer right now but the most recent merged pull request here talks about how to get the device id from your computer and then use the env var ANDROID_ID for one of the valid devices.
On Sun, May 27, 2018, 9:56 AM Oleg notifications@github.com wrote:
Hi guys, I am facing the same issue today
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/stevenleeg/geemusic/issues/220#issuecomment-392332810, or mute the thread https://github.com/notifications/unsubscribe-auth/AJN8OGxHBpPcE5f_0jxAqbFvQmC-Txykks5t2rB7gaJpZM4UPFmF .
@fergyfresh Thank you that was helpful. Here's the steps I went through to fix it:
$ foreman start
13:41:02 web.1 | started with pid 5587
13:41:10 web.1 | Traceback (most recent call last):
13:41:10 web.1 | File "server.py", line 1, in <module>
13:41:10 web.1 | from geemusic import app
13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/__init__.py", line 26, in <module>
13:41:10 web.1 | api = GMusicWrapper.generate_api(logger=app.logger)
13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/utils/music.py", line 267, in generate_api
13:41:10 web.1 | **kwargs)
13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/utils/music.py", line 14, in __init__
13:41:10 web.1 | success = self._api.login(username, password, environ.get('ANDROID_ID', Mobileclient.FROM_MAC_ADDRESS))
13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 143, in login
13:41:10 web.1 | self.android_id = self._validate_device_id(device_id, is_mac=is_mac)
13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 58, in _validate_device_id
13:41:10 web.1 | raise InvalidDeviceId('Invalid device_id %s.' % device_id, devices)
13:41:10 web.1 | gmusicapi.exceptions.InvalidDeviceId: Invalid device_id HEYBUDDY.Your valid device IDs are:
13:41:10 web.1 | * 37b1
13:41:10 web.1 | * 9890
13:41:10 web.1 | * 3f39
13:41:10 web.1 | * 3c61
13:41:10 web.1 | * e49f
13:41:10 web.1 | * 3824
13:41:10 web.1 | * 6067
13:41:10 web.1 | * 68A3
13:41:10 web.1 | * 0022
13:41:11 web.1 | exited with code 1
(note, I truncated the actual device IDs for .. uh.. security I guess - they will be much longer IDs)
So that's was I was saying. Foreman is running on your PC and the command that spits out the valid device ids is something you can call yourself to grab the valid device ids linked to your account.
On Sun, May 27, 2018, 4:47 PM Adam Plocher notifications@github.com wrote:
@fergyfresh https://github.com/fergyfresh Thank you that was helpful. Here's the steps I went through to fix it:
- Editted my .env file (the one with all the config values for geemusic)
- Added a line like: ANDROID_ID=HEYBUDDY (note, HEYBUDDY is invalid)
- Went to start foreman, but it will fail right away with a list of your device IDs (there's probably a better way to do this...)
$ foreman start 13:41:02 web.1 | started with pid 5587 13:41:10 web.1 | Traceback (most recent call last): 13:41:10 web.1 | File "server.py", line 1, in
13:41:10 web.1 | from geemusic import app 13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/init.py", line 26, in 13:41:10 web.1 | api = GMusicWrapper.generate_api(logger=app.logger) 13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/utils/music.py", line 267, in generate_api 13:41:10 web.1 | *kwargs) 13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/geemusic/utils/music.py", line 14, in init 13:41:10 web.1 | success = self._api.login(username, password, environ.get('ANDROID_ID', Mobileclient.FROM_MAC_ADDRESS)) 13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 143, in login 13:41:10 web.1 | self.android_id = self._validate_device_id(device_id, is_mac=is_mac) 13:41:10 web.1 | File "/home/adam/src/geemusic-new/geemusic/.vnee/lib/python3.6/site-packages/gmusicapi/clients/mobileclient.py", line 58, in _validate_device_id 13:41:10 web.1 | raise InvalidDeviceId('Invalid device_id %s.' % device_id, devices) 13:41:10 web.1 | gmusicapi.exceptions.InvalidDeviceId: Invalid device_id HEYBUDDY.Your valid device IDs are: 13:41:10 web.1 | 37b1 13:41:10 web.1 | 9890 13:41:10 web.1 | 3f39 13:41:10 web.1 | 3c61 13:41:10 web.1 | e49f 13:41:10 web.1 | 3824 13:41:10 web.1 | 6067 13:41:10 web.1 | 68A3 13:41:10 web.1 | 0022 13:41:11 web.1 | exited with code 1 (note, I truncated the actual device IDs for .. uh.. security I guess - they will be much longer IDs)
- Edit your .env file again
- Change the ANDROID_ID to a valid one from the list. Try the first ID in your "valid IDs" list. I suppose if it still fails, try the next one until it doesn't fail. Mine worked right away with the first one listed.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/stevenleeg/geemusic/issues/220#issuecomment-392365924, or mute the thread https://github.com/notifications/unsubscribe-auth/AJN8OMGtWPi6h4O0nVwjYTEmr0eLWZ0Iks5t2xD_gaJpZM4UPFmF .
Thanks @aplocher !
You can do the same type of process with Heroku. Edit the Heroku input variables under the Settings Tab to include ANDROID_ID=HEYBUDDY (I just used the same dummy ID). Then after the program fails go to the Heroku activity logs in the pulldown "More" menu and there will be a list of 16 character IDs. I just chose one and it is streaming again.
I had 3 ID in the list (all from iOS devices). But no one worked for me. Thankfully I have android device which I am not already using. So I opened google music on it, than tried to do the same steps, added real android device id and now everything works!. Thanks a lot.
I was having the same issue, this fixed it! Thank you!
It it allow 12char ids?
@Bronskiy it appears as if it doesn't. The old style way of using MAC Addresses to generate the Device ID appears to be quite finicky. If you have any computers that can play music from Google Play try this.
from gmusicapi import Mobileclient
email = "myredactedemail@email.email"
app_pw = "myrandomapppassword"
api = Mobileclient.login(email, app_pw, Mobileclient.FROM_MAC_ADDRESS)
my_registered_devices = api.get_registered_devices()
If you look through the my_registered_devices
and try to find one that says ANDROID_ID
you might be able to get in there. Otherwise, you'll have to bring it up here https://github.com/simon-weber/gmusicapi
Also if anyone who didn't use android devices with google music before then you can use one of android emulators like Nox, Genymotion(trial) or AndY. Just login with your google account and run g.music app and try to start any track. Then new device id will appear in your 'valid device IDs' so you can use it in geemusic. FYI: my problem is solved now. Thanks to everyone.
I'm also running into this issue. I only have IOS and PC devices. Do you absolutely need an android id for this to work? I'm able to log in with an app specific password for instance the success = self._api.login is a success with a PC or IOS id, but I'm getting an issue with actually streaming music, which i think is caused by the call not having authorization ie Authorization': 'omitted' .
gmusicapi.exceptions.CallFailure: GetStreamUrl: 403 Client Error: Forbidden for url: https://mclients.googleapis.com/music/mplay?opt=hi&net=mob&pt=e&slt=1578542451332&sig=eXp-g0Foi1UeYIEazw05uKNFfQA&mjck=T4qimilrtjxqqhkwnnayaito3su&hl=en_US&dv=0&tier=aa
04:00:54 web.1 | (requests kwargs: {'method': 'GET', 'url': 'https://mclients.googleapis.com/music/mplay', 'allow_redirects': False, 'headers': {'X-Device-ID': 'f43d95c81a5254ef6603b8438526acc21a83ce3a0c7f87c1438df618df0e0476', 'Authorization': '
Hello, I had my Echo Dot turned off for the last month or so. I've recently plugged it back in and now when I go to use GeeMusic I'm receiving a 403-forbidden error from Google when it tries to start the stream.
Listing my playlists and other non-song-playing commands seem to work just fine.
Anyone know why? Was there a recent update to the code that I need to grab?
Everything was working fine last time I used it (like a month or so ago), but now it's not working. I last git-pulled and built geemusic I think in February, so it's not too terribly old.
I've pasted the output that I got from Foreman below...
Thank you!