Jaffa / amazon-music

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

No longer working? #30

Open mkanet opened 4 years ago

mkanet commented 4 years ago

@Jaffa

Does this solution still work? I installed the requred libraries: Requests and Beautiful Soup on Python 2.7 and used the most basic script (code below). However, I keep getting the below errors when executing. Is there anything more that I have to do to get it to work correctly? I have an amazon unlimited account in United States. PS: I need to do this under Python 2.7. Hopefully this project hasn't been abandoned.

Traceback (most recent call last): File "c:/Users/Michael/OneDrive/Dev/Projects/Python/test-amazonmusic.py", line 12, in am = AmazonMusic(credentials=['amazonusername', 'password']) File "c:\Users\Michael\OneDrive\Dev\Projects\Python\amazonmusic.py", line 107, in init app_config = json.loads(re.sub(r'^[^{]*', '', re.sub(r';$', '', line))) File "C:\Users\Michael\AppData\Local\Programs\Python\python27\lib\json__init__.py", line 339, in loads return _default_decoder.decode(s) File "C:\Users\Michael\AppData\Local\Programs\Python\python27\lib\json\decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Michael\AppData\Local\Programs\Python\python27\lib\json\decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

from amazonmusic import AmazonMusic
import os

am = AmazonMusic(credentials=[myamazonemailaddress', 'mypassword'])

station = am.create_station('MICHAEL JACKSON')
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()))
ADMadera commented 4 years ago

The html changed a bit.

Change the if statement from

            for line in r.iter_lines(decode_unicode=True):
                if 'amznMusic.appConfig = ' in line:

to

            for line in r.iter_lines(decode_unicode=True):
                if 'var applicationContextConfiguration =' in line:

https://github.com/Jaffa/amazon-music/blob/master/amazonmusic.py#L106