deezer-downloader icon indicating copy to clipboard operation
deezer-downloader copied to clipboard

Unable to download songs

Open titouanfuchs opened this issue 3 years ago • 35 comments

Today i tried to download some new songs, and i get an error for a lot (but not all) songs. Like :

_`Downloading 'Metallica - Nothing Else Matters.mp3'

ERROR: Can not download this song. Got a 403

worker 0 is done with task: {'track_id': 1489945622, 'add_to_playlist': False} (state=mission accomplished)

Worker 0 is waiting for a task`_

titouanfuchs avatar Sep 19 '21 18:09 titouanfuchs

Can confirm, happened to me as well. Doesn't happen with every song, some will download succesfully.

roymcclure avatar Sep 22 '21 10:09 roymcclure

can confirm, too. It's a known issue for some songs. But it feels like it's occcuring more often than in the past. I will take a look the next days.

kmille avatar Sep 22 '21 11:09 kmille

Same here.

Gwynei avatar Sep 22 '21 14:09 Gwynei

Same for me. When I first started using the app about 3 months ago, I could download what ever I wanted in FLAC quality. Now FLAC is NOT downloading about 99.9% of the songs I tried. MP3 is like playing the lottary, about 30% of the songs I tried actually downloaded succesfully. Same goes for albums and ZIP files, it will just jump over the songs with 403 error.

I tried switching the cookie but no dice, everything is the same. I even tried with a different account, thinking Deezer is somehow blocking me. Haven't tried with a different IP so this is still a possibility.

dejan995 avatar Sep 26 '21 00:09 dejan995

@dejan995 I tried with a different ip and still got the same result. Maybe they implemented some algorithm that chokes the stream when it detects "suspicious" song requests.

roymcclure avatar Sep 26 '21 06:09 roymcclure

Deezer is migrating to a new API.

You can still download the song '2CELLOS - Viva La Vida'. DeezerDownloader sends the following request: GET https://e-cdns-proxy-6.dzcdn.net/mobile/1/afe81113ad95767f887d8e89f1e7445f6f60f39375a65b5d4c69af22e09b7ce27d224f14ea853bb619d3a442e82c8c51a8161c4f1a5c3abac27a11a5277b4c021dcdd983071d3c8351cf5efcff043a75

If you play the song in the browser and check the sent requests in the debugger console:

first try

curl 'https://e-cdnt-proxy-6.dzcdn.net/media/1/9faa604a98bdf6f9746751b2ca2311d6574d3d108fc808c8babb8344aca4eb62aecc3d93512abe29ef210ad0704a93bd14a8164d7e8a432288d7e1e352ab6b95abdbb9b016769f24599f1d1b0a941507?09c2au7GzrhqFum9AN-fFFYHuPcg9IQB0u5eFVZz0nyXs7O1dN5QhqmFWCs1j3kauhu4ZkjZlI_nRKB2iguOH58ZM31H4s0o3OwM9r1nWvIs1YwOE-YE-u-65TYRamXnx4gRevvDpaiiuytZBWE7Htl04OkbJFl_N7QNGi3aSH_ZIioLnPHmaTVs01QI9jbNnympS338Yc--8X4ZbxSFHziHHREYkZv5DseC5NzMIe5iNmDSAl1HDa6SL9F0l96gjpck7Cnd0iaJSgad_SuKtFUC0xBuADt83JcyGEmrIf46SEbbt8pou87Eq16-kJ2JiJj8X-uawsfa-A' \
  -H 'authority: e-cdnt-proxy-6.dzcdn.net' \
  -H 'sec-ch-ua: "Chromium";v="93", " Not;A Brand";v="99"' \
  -H 'accept: */*' \
  -H 'dnt: 1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'origin: https://www.deezer.com' \
  -H 'sec-fetch-site: cross-site' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://www.deezer.com/' \
  -H 'accept-language: en-US,en;q=0.9' \
  --compressed

second time

curl 'https://e-cdnt-proxy-6.dzcdn.net/media/1/9faa604a98bdf6f9746751b2ca2311d6574d3d108fc808c8babb8344aca4eb62aecc3d93512abe29ef210ad0704a93bd14a8164d7e8a432288d7e1e352ab6b95abdbb9b016769f24599f1d1b0a941507?uB1xpuEd4O33lvgYHLPkwIDPxf_eKmvQhCYHMhSfHkT8p0IXYHkPpNSvT8ZdVEptjc6fQYJ26g9nBMpawuJHAcU0dJfYebthCHV4EIYI7H1mtnhlFvwPYsdTFkxnmqWR3cqnI6oBgjCCSXdluRM1bETPHvFgr4serJbfsXb7zyvoeoksLstEGaz04bRylheOfRWmgh9cbANlC44GSmirvY12uT2zRowcy4-uJ2Qb1ssv-0xMp8mFlZeqcan9h_44I2mGU7lWjeYJ0GR89NJk1qDOfPvU3yurQNTS4IV4FrAq9hlKqj9f8Krd1JRkCwQtZRe63k2bfrycpw' \
-H 'authority: e-cdnt-proxy-6.dzcdn.net' \
-H 'sec-ch-ua: "Chromium";v="93", " Not;A Brand";v="99"' \
-H 'dnt: 1' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'accept: */*' \
-H 'origin: https://www.deezer.com' \
-H 'sec-fetch-site: cross-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://www.deezer.com/' \
-H 'accept-language: en-US,en;q=0.9' \
--compressed

Understanding the javascript is pain.

kmille avatar Sep 26 '21 09:09 kmille

Understanding the javascript is pain.

Apparently they use software for obfuscating names of functions and variables.

roymcclure avatar Sep 26 '21 18:09 roymcclure

I went on a little wild goose chase today and found this project: https://github.com/nathom/streamrip

Using it, I was able to fully download about 5 albums that where not downloading using Deezer Downloader, including 2CELLOS - Viva La Vida. @HaagenProd I was not able to download the Metalica track from from your post, I recieved this error: Track token has no sufficient rights on requested media, it is possible that this track has some special protection of some sorts.

NOTE: Everything mentioned above was downloaded without providing an ARL. As soon as I added one, the same problems from Deezer Downloader have started showing up.

@kmille The project linked, when it has no ARL provided uses something called Deezloader to download the tracks. I could not find much information about it though. Maybe you can take a look? This looks like it might provide some answeres and solutions for this problem.

dejan995 avatar Sep 27 '21 01:09 dejan995

Yeah the Metallica track is from the new remastered Black album, maybe it's protected idk, but I also wanted to download older albums but nothing worked. @dejan995

titouanfuchs avatar Sep 27 '21 03:09 titouanfuchs

Can you give me an example song, that works with streamrip, but not with DeezerDownloader? 2CELLOS - Viva La Vida still works with DeezerDownloader. For example 'Patrice - Fear Rules' (https://www.deezer.com/us/track/858978) does not work with both of them.

(venv) kmille@linbox:streamrip rip url https://www.deezer.com/us/track/858978
Falling back to Deezloader (unstable). If you have a subscription, run rip config --deezer to log in.
{'thumbnail': 'https://api.deezer.com/album/98257/image', 'small': 'https://cdns-images.dzcdn.net/images/cover/7efb32e8a722cf1413d4fa120f298110/250x250-000000-80-0-0.jpg', 'large': None, 'original': 'https://cdns-images.dzcdn.net/images/cover/7efb32e8a722cf1413d4fa120f298110/1000x1000-000000-80-0-0.jpg'}
Downloading Patrice - Fear Rules (Album Version)


  AttributeError

  'Track' object has no attribute 'folder'

  at venv/lib/python3.9/site-packages/streamrip/media.py:241 in _prepare_download
       237│         self.quality = min(
       238│             kwargs["quality"], self.client.max_quality, self.meta.quality
       239│         )
       240│ 
    →  241│         self.folder = kwargs["parent_folder"] or self.folder
       242│ 
       243│         if not self.part_of_tracklist and kwargs["add_singles_to_folder"]:
       244│             self.folder = os.path.join(
       245│                 self.folder,

If this was unexpected, please open a Bug Report at https://github.com/nathom/streamrip/issues/new/choose
(venv) kmille@linbox:streamrip                                               

Are you using streamrip with a subscription?

Falling back to Deezloader (unstable). If you have a subscription, run rip config --deezer to log in.

kmille avatar Sep 27 '21 08:09 kmille

If you don't supply login credentials, streamrip downloads the song from dz.loaderapp.info. Kinda weird?

GET /proxydownload/Music/9/Viva%20La%20Vida-12241569.flac HTTP/1.1
Host: dz.loaderapp.info
User-Agent: python-requests/2.26.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive

loaderapp.info belongs to a mobile app. The android app has ~50 downloads (https://play.google.com/store/apps/details?id=com.sayem.downloader)!? rip gives you the option to supply an ARL cookie like we do. And the code uses the same API we use.

return f"https://e-cdns-proxy-{track_hash[0]}.dzcdn.net/mobile/1/{path}"
(venv) kmille@linbox:streamrip rip config --deezer                            
Follow the instructions at https://github.com/nathom/streamrip/wiki/Finding-your-Deezer-ARL-Cookie
Paste your ARL here:  

I think streamrip will have the same problem in the future. But I'm happy about any hints!

UPDATE 1: streamrip requests GET dz.loaderapp.info/deezer/1411/https://api.deezer.com/track/12241569 which redirects to /proxydownload/Music/9/Viva%20La%20Vida-12241569.flac. The 1411 is hard coded (means 'deezer' and quality '2').

kmille avatar Sep 27 '21 09:09 kmille

@kmille Here is an example LISA - MONEY Deezer Downloader can't download this track. Streamrip downloads it but without ARL. When I tried the same song with ARL provided streamrip could not download it.

Tried downloading Patrice - Fear Rules on both Deezer Downloader and streamrip. It faild to download on both. Deezer Downlader gave me the usual 403 error. Streamrip without ARL gave me Track token has no sufficient rights on requested media. When I put my ARL it gave me an empty error message, just this: Unable to stream Patrice - Fear Rules (Album Version). Message:

Are you using streamrip with a subscription?

Everything I tried so far I have done both ways, with ARL and without ARL. Keep in mind my Deezer account is on the Free Plan. No premium subscriptions.

  • Without ARL, so far, I'm able to download all the songs I was not able to download using Deezer Downloader. Exceptions are the Metalica track from @HaagenProd and the Patrice - Fear Rules track.
  • With ARL, so far, I was not able to download anything. Always the same error message: Unable to stream track_name. Message:

If you don't supply login credentials, streamrip downloads the song from dz.loaderapp.info. Kinda weird?

Yes, this is weird. Looking from the error messages I got in my browser when trying to directly download tracks using this: dz.loaderapp.info/deezer/1411/https://api.deezer.com/track/track_id, I think that dz.loaderapp.info is actually hosting some modified version of streamrip or streamrip is based on something that loaderapp.info uses.

Error Message: {"statusCode":500,"error":"Internal Server Error","message":"code,2002, message,Track token has no sufficient rights on requested media."}

The error message is exactly the same as the one I get in the CLI. I have no idea what is going on here.

I looked on the GitHub profiles for both developers, the one that owns the streamrip repo and the one that is credited as the developer of the Loader app on the Play Store. Looks like these projects are not connected to eachother. Also, whatever is hosted on dz.loaderapp.info seems to be private code because I could not find any reference for it on the GitHub profile of the Loader app developer.

dejan995 avatar Sep 27 '21 17:09 dejan995

I think deezer rewrited their DRM. Same error with all of the tracks in new Drake album.

fukurosim avatar Oct 06 '21 13:10 fukurosim

I have been able to partially resolve this by converting the FILESIZE_* value to an int. I noticed they were strings.

see

'FILESIZE_AAC_64': '0', 'FILESIZE_MP3_64': '0', 'FILESIZE_MP3_128': '3064057', 'FILESIZE_MP3_256': '0', 'FILESIZE_MP3_320': '7660146', 'FILESIZE_MP4_RA1': '0', 'FILESIZE_MP4_RA2': '0', 'FILESIZE_MP4_RA3': '0', 'FILESIZE_MHM1_RA1': '0', 'FILESIZE_MHM1_RA2': '0', 'FILESIZE_MHM1_RA3': '0', 'FILESIZE_FLAC': '0',

so at this line it will always put me song quality 9 even when it is not available. https://github.com/kmille/deezer-downloader/blob/master/app/deezer.py#L330

rllola avatar Oct 07 '21 21:10 rllola

It seems that sometime it indicates that MP3 320 is available when it is not. I can always download in song_quality = 1...

rllola avatar Oct 07 '21 23:10 rllola

gg @rllola you nailed it.

replacing lines 330 to 333 with

    song_quality = 9 if song.get("FILESIZE_FLAC") and song.get("FILESIZE_FLAC") != '0' and config['deezer'].getboolean('flac_quality') else \
                   3 if song.get("FILESIZE_MP3_320") and song.get("FILESIZE_MP3_320") != '0' else \
                   5 if song.get("FILESIZE_MP3_256") and song.get("FILESIZE_MP3_256") != '0' else \
                   1

allows you to download any song.

I believe they increased the authorization granularity, and they now check if you are premium or not and limit the audio quality accordingly. I still need to validate this assumption, but seeing 2021 songs available only at 128kbps and getting a 403 when trying to access the FLAC or 320kbps files (instead of a 404), leads me to think that.

@kmille worth adding the fix above (or through integer casting) for the time being?

LucaMozzo avatar Nov 24 '21 00:11 LucaMozzo

sounds good. I hope I will get it done in the next few days.

kmille avatar Nov 24 '21 11:11 kmille

I applied the fix in 172f5c6100f4ac5b384222c0ad8fff8c6be19320. Thanks @rllola. I removed the flac feature. It now works with a free account. But with the ARL cookie of my premium subscription account it behaves as follows:

free account download mp3 -> download with 128kbit/s (before it was 320kbit/s) flac -> doesn't work. I removed the feature instead of always switching to mp3 (in this case, there was no 403 error)

premium subscription mp3 -> 403 flac -> 403 I don't understand why it happens this way. But the general download functionality finally works again.

kmille avatar Nov 26 '21 16:11 kmille

any luck with 403? From 180 songs on playlist downloaded 3 in 320kbps, rest is 403 :(

Running on Docker@Windows 10 with premium subscription

majes1 avatar Dec 20 '21 16:12 majes1

same, premium subscription and downloading is not working at all (403 error)

nickberto avatar Jan 08 '22 15:01 nickberto

At the moment, downloading 128 kbit/s mp3 is working (free plan is enough). Please update the docker image you use.

kmille avatar Jan 12 '22 16:01 kmille

I can confirm it behaves exactly the way you guys have described (premium subscription -> 403). I've just created a bogus free account a couple of minutes ago and everything is "smooth" now, just downloaded a whole playlist (well, 48 of 50 songs, but hey, I'm fine with that). Good job, @kmille!

alipio avatar Jan 20 '22 16:01 alipio

Any ideas on how to download 320kbps? I've upgraded to pro, and indeed: the download times out entirely.

robvaneck avatar Jan 16 '23 13:01 robvaneck

While searching for a way to download FLAC songs from deezer, I found this project which I just tested and is currently working.

Maybe this could help you to fix your own problem (even if it's written in Go) ? It seems to use more keys than the arl cookie (see the project README).

Pan6ora avatar Feb 02 '23 16:02 Pan6ora

There's a different project called deemix that works for my ~~HiFi~~ free account, specifically used the GUI for me. (THIS IS NO LONGER SUPPORTED BY ITS CREATOR, though it still works for me)

TylerWDoesStuff avatar Feb 19 '23 09:02 TylerWDoesStuff

Does deemix really work for you? Check the files, most likely 128kbit mp3.

MightySmallBalls avatar Aug 29 '23 09:08 MightySmallBalls

Every song is returning 403 for me, this seems totally broken. =/

dtromb avatar Nov 29 '23 19:11 dtromb

Every song is returning 403 for me, this seems totally broken. =/

Are you using a cookie from a free subscription account?

kmille avatar Nov 29 '23 21:11 kmille

I also get the 403 for every song with a paid account

staeter avatar Dec 04 '23 21:12 staeter

There's a different project called deemix that works for my ~HiFi~ free account, specifically used the GUI for me. (THIS IS NO LONGER SUPPORTED BY ITS CREATOR, though it still works for me)

Thx for the tipp! Works well for me, even with paid account! Still only 128kbit, but the GUI is easy to handle...

KmdKeen avatar Jan 12 '24 12:01 KmdKeen