Jaffa / amazon-music

Provide programmatic access to Amazon Music/Prime Music's streaming service
Apache License 2.0
342 stars 69 forks source link

Unable to authenticate for users outside US #23

Open lohriialo opened 5 years ago

lohriialo commented 5 years ago

The login points to music.amazon.com for authentication however, me as a user from India, my music is not accessible from amazon.com instead it's accessible on amazon.in

Should do something to dynamically point to the correct endpoint for every country or else allow user to manually choose login api endpoint

Jaffa commented 5 years ago

Sorry for the problem, and the delay in replying. This could be possibly related to #19?

In the UK, going to https://music.amazon.com redirects to the appropriate site once logged in (in this case music.amazon.co.uk).

Does that not happen for the Indian site?

lohriialo commented 5 years ago

Still unable to authenticate, here's how i'm trying to use and the error I got

from amazonmusic import AmazonMusic
import os

amazon_music = AmazonMusic(credentials=['****', '*****'])
station = amazon_music.create_station('A2FRGLRCG7IBYS')
print('Playing station {0}...'.format(station.name))
for t in station.tracks:
    print('Playing {0} by {1} from {2} [{3}]...'.format(t.name, t.artist, t.album, t.albumArtist))
    os.system('cvlc --play-and-exit "{0}"'.format(t.getUrl()))
Traceback (most recent call last):
  File "/Users/user/PycharmProjects/AmazonMusic/getStationPlaylist.py", line 4, in <module>
    amazon_music = AmazonMusic(credentials=['******, '********'])
  File "/Users/user/PycharmProjects/AmazonMusic/amazonmusic.py", line 102, in __init__
    r = self._authenticate(r)
  File "/Users/user/PycharmProjects/AmazonMusic/amazonmusic.py", line 152, in _authenticate
    raise Exception("Unable to handle captcha: {}".format(tag))
Exception: Unable to handle captcha: [<source data-refresh-url="/ap/captcha?appAction=SIGNIN&amp;captchaType=audio&amp;marketPlaceId=ATVPDKIKX0DER" id="mp3-file" src="https://opfcaptcha-prod.s3.amazonaws.com/9cd4424d1c1447c4b49bec52fa873634.jpg?AWSAccessKeyId=****&amp;Expires=***&amp;Signature=****%3D" type="audio/mpeg"/>]
Jaffa commented 5 years ago

Still unable to authenticate

Is that with changing the URL to music.amazon.in? What happens when you go to music.amazon.com in a browser and you sign in?

The Unable to handle captcha issue is #19.

lohriialo commented 5 years ago

Above error is when calling music.amazon.com. A different error if I change the endpoint to music.amazon.in

Traceback (most recent call last):
  File "/Users/users/PycharmProjects/AmazonMusic/getStationPlaylist.py", line 4, in <module>
    amazon_music = AmazonMusic(credentials=['*******', '=['*******','])
  File "/Users/users/PycharmProjects/AmazonMusic/amazonmusic.py", line 112, in __init__
    raise Exception("Unable to find appConfig in {}".format(r.content))
Exception: Unable to find appConfig in b'\n\n\n\n
lohriialo commented 5 years ago

On browser, when you go to music.amazon.com, it redirects to https://www.amazon.in/ap/signin Once logged in, goes to music.amazon.in