glomatico / gamdl

A Python CLI app for downloading Apple Music songs/music videos/posts.
582 stars 76 forks source link

Not Able to pull a few songs that are stremable #124

Closed vijaykrpp closed 1 day ago

vijaykrpp commented 2 days ago

I am using this tool a lot. But I found that it fails to download songs often, even though it is available to stream on Apple Music.

Example: https://music.apple.com/kr/album/supernova/1745285216?i=1745285219

Log:

(env) root@reliablesite:~/django# gamdl https://music.apple.com/kr/album/supernova/1745285216?i=1745285219 Traceback (most recent call last): File "/root/django/env/bin/gamdl", line 8, in sys.exit(main()) ^^^^^^ File "/root/django/env/lib/python3.12/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/django/env/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/root/django/env/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/django/env/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/django/env/lib/python3.12/site-packages/gamdl/cli.py", line 348, in main apple_music_api = AppleMusicApi( ^^^^^^^^^^^^^^ File "/root/django/env/lib/python3.12/site-packages/gamdl/apple_music_api.py", line 31, in init self._set_session() File "/root/django/env/lib/python3.12/site-packages/gamdl/apple_music_api.py", line 39, in _set_session self.storefront = self.session.cookies.get_dict()["itua"]


KeyError: 'itua'
glomatico commented 2 days ago

You exported your cookies from the wrong website. Try exporting them again.

vijaykrpp commented 1 day ago

Actually no. I exported from https://music.apple.com/ in Netscape format. I have a Premium account. Most of songs work. But few (like mentioned) doesn't.

vijaykrpp commented 1 day ago

I have also created a website using your project: http://aaplmusicdownloader.com/

You can test it there too. [In event of failure, it downloads using Spotdl]

glomatico commented 1 day ago

That's actually a cookies file parsing error. Are you using the same cookies file to download all songs? It should have failed for every song then.

vijaykrpp commented 1 day ago

Yes. using same cookies [cookies.txt file saved on server] for every song download. It works with 90-95% success rate. Rest 5% time it fails like this. Yes its a parsing error but not sure why this error happens on specific songs and not on all songs.

glomatico commented 1 day ago

Huh. You are creating a new season for every new download then. Try making a new season only when your server starts, so you don't have to constantly send requests to Apple.