WorldObservationLog/AppleMusicDecrypt

Failing to decrypt

ngagne opened this issue · 7 comments

Hi, I've followed the guide a few times and verified all of the programs are running as expected. I installed the Apple Music beta, logged into my paid account, set audio quality to lossless, played a track, etc. Everything seems to be working when I start the script, but it fails on the decryption part. What can I do to debug decryption failure?

raised DecryptException?

yes, seems to fail when decrypting the sample

It's a common problem. Try to restart the script and download it

Thanks for your response. Here is the error I'm seeing:

2024-05-15 19:53:17.228 | ERROR    | asyncio.events:_run:84 - An error has been caught in function '_run', process 'MainProcess' (34993), thread 'MainThread' (8562801344):
Traceback (most recent call last):

  File "/Users/nickgagne/Library/Caches/pypoetry/virtualenvs/applemusicdecrypt-u0QR3Q5x-py3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
                   │   │       └ {}
                   │   └ (SongInfo(codec='alac', raw=b'\x00\x00\x00$ftypiso5\x00\x00\x00\x01isomiso5hlsfcmfcccea\x00\x00\x03\xecmoov\x00\x00\x00lmvhd\...
                   └ <function decrypt at 0x10833cc20>

  File "/Users/nickgagne/Development/AppleMusicDecrypt/src/decrypt.py", line 40, in decrypt
    raise e

  File "/Users/nickgagne/Development/AppleMusicDecrypt/src/decrypt.py", line 36, in decrypt
    result = await decrypt_sample(writer, reader, sample)
                   │              │       │       └ SampleInfo(data=b'X\x1c\xe7o\xf8\x16e$\xcd\xa3\xf5b\x16\x92\xb4\xf5\x84\x8dDCYY\x92`U\x057\x8a!\x9dnq\xfa)\r\xeb8U\xfex0\x17\...
                   │              │       └ <StreamReader eof transport=<_SelectorSocketTransport closing fd=19 read=idle write=<idle, bufsize=0>>>
                   │              └ <StreamWriter transport=<_SelectorSocketTransport closing fd=19 read=idle write=<idle, bufsize=0>> reader=<StreamReader eof t...
                   └ <function decrypt_sample at 0x10833cb80>

  File "/Users/nickgagne/Development/AppleMusicDecrypt/src/decrypt.py", line 52, in decrypt_sample
    raise DecryptException
          └ <class 'src.exceptions.DecryptException'>

src.exceptions.DecryptException


The above exception was the direct cause of the following exception:



  File "/Users/nickgagne/Development/AppleMusicDecrypt/src/rip.py", line 73, in rip_song
    decrypted_song = await decrypt(song_info, keys, song_data, device)
                           │       │          │     │          └ <src.adb.Device object at 0x10b8f5790>
                           │       │          │     └ Datum(id='1703362577', type='songs', href='/v1/catalog/us/songs/1703362577?l=en-US', attributes=Attributes(hasTimeSyncedLyric...
                           │       │          └ ['skd://itunes.apple.com/P000000000/s1/e1', 'skd://itunes.apple.com/p614286665/c23']
                           │       └ SongInfo(codec='alac', raw=b'\x00\x00\x00$ftypiso5\x00\x00\x00\x01isomiso5hlsfcmfcccea\x00\x00\x03\xecmoov\x00\x00\x00lmvhd\x...
                           └ <function decrypt at 0x10833cea0>

  File "/Users/nickgagne/Library/Caches/pypoetry/virtualenvs/applemusicdecrypt-u0QR3Q5x-py3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
                 │   │       └ {}
                 │   └ (SongInfo(codec='alac', raw=b'\x00\x00\x00$ftypiso5\x00\x00\x00\x01isomiso5hlsfcmfcccea\x00\x00\x03\xecmoov\x00\x00\x00lmvhd\...
                 └ <function decrypt at 0x10833cd60>
  File "/Users/nickgagne/Library/Caches/pypoetry/virtualenvs/applemusicdecrypt-u0QR3Q5x-py3.11/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         │    │                └ <RetryCallState 4829612816: attempt #3; slept for 0.0; last result: failed (DecryptException )>
         │    └ <function BaseRetrying.iter at 0x107b3df80>
         └ <AsyncRetrying object at 0x1080a1dd0 (stop=<tenacity.stop.stop_after_attempt object at 0x1080a1e90>, wait=<tenacity.wait.wait...
  File "/Users/nickgagne/Library/Caches/pypoetry/virtualenvs/applemusicdecrypt-u0QR3Q5x-py3.11/lib/python3.11/site-packages/tenacity/__init__.py", line 326, in iter
    raise retry_exc from fut.exception()
          │              │   └ <function Future.exception at 0x102b86980>
          │              └ <Future at 0x12b9e3c90 state=finished raised DecryptException>
          └ RetryError(<Future at 0x12b9e3c90 state=finished raised DecryptException>)

tenacity.RetryError: RetryError[<Future at 0x12b9e3c90 state=finished raised DecryptException>]

I've tried this on Windows x64 and MacOS arm64, but I'm continuing to face the same error above.

Please check the following precautions:

  • Android Emulator for x86_64 architecture, without Google API
  • Apple Music Android 3.6.0-beta x86_64
  • Already login your Apple Music account and has a vaild subscription
  • Can play music normally in Apple Music in the emulator

closed due to no progress