Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to download songs #66

Open
titouanfuchs opened this issue Sep 19, 2021 · 35 comments
Open

Unable to download songs #66

titouanfuchs opened this issue Sep 19, 2021 · 35 comments

Comments

@titouanfuchs
Copy link

titouanfuchs commented Sep 19, 2021

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`_

@roymcclure
Copy link

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

@kmille
Copy link
Owner

kmille commented Sep 22, 2021

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.

@Gwynei
Copy link

Gwynei commented Sep 22, 2021

Same here.

@dejan995
Copy link

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.

@roymcclure
Copy link

@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.

@kmille
Copy link
Owner

kmille commented Sep 26, 2021

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.

@roymcclure
Copy link

Understanding the javascript is pain.

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

@dejan995
Copy link

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.

@titouanfuchs
Copy link
Author

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

@kmille
Copy link
Owner

kmille commented Sep 27, 2021

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
Copy link
Owner

kmille commented Sep 27, 2021

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').

@dejan995
Copy link

@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.

@fukurosim
Copy link

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

@rllola
Copy link

rllola commented Oct 7, 2021

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
Copy link

rllola commented Oct 7, 2021

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

@LucaMozzo
Copy link

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?

@kmille
Copy link
Owner

kmille commented Nov 24, 2021

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

kmille added a commit that referenced this issue Nov 26, 2021
tries to fix this #66. Removes the ability to download flac files
@kmille
Copy link
Owner

kmille commented Nov 26, 2021

I applied the fix in 172f5c6. 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.

@majes1
Copy link

majes1 commented Dec 20, 2021

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

Running on Docker@Windows 10 with premium subscription

@nickberto
Copy link

nickberto commented Jan 8, 2022

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

@kmille
Copy link
Owner

kmille commented Jan 12, 2022

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

@alipio
Copy link

alipio commented Jan 20, 2022

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!

@robvaneck
Copy link

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

@Pan6ora
Copy link

Pan6ora commented Feb 2, 2023

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).

@TylerWDoesStuff
Copy link

TylerWDoesStuff commented Feb 19, 2023

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)

@MightySmallBalls
Copy link

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

@dtromb
Copy link

dtromb commented Nov 29, 2023

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

@kmille
Copy link
Owner

kmille commented Nov 29, 2023

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

Are you using a cookie from a free subscription account?

@staeter
Copy link

staeter commented Dec 4, 2023

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

@KmdKeen
Copy link

KmdKeen commented Jan 12, 2024

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...

@alipio
Copy link

alipio commented Jan 15, 2024

Guys, I managed to download a full playlist two weeks ago using a free account, just as usual.

@javi242
Copy link

javi242 commented Mar 11, 2024

Hi, I'm using docker like this:

sudo docker run -p 5000:5000 --volume $(pwd)/downloads/:/mnt/deezer-downloader --env DEEZER_COOKIE_ARL=changeme kmille2/deezer-downloader:latest

with my arl cookie of course. Then I open http://localhost:5000 in browser and I can search for songs and listen to preview but when trying to download I always get the error "Can not download this song. Got a 403".

Any ideas? Thanks in advance.

@javi242
Copy link

javi242 commented Mar 13, 2024

Ok now I got it working, using a free account, but the quality is 128. Is there a way to download using my premium account so the quality is 320? Thanks in advance.

@jesusj
Copy link

jesusj commented Mar 17, 2024

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).

I tested the project @Pan6ora mentioned and it works correctly, the content is there. I made a small modification to the Go file in that repo and besides the FLAC it is possible to download the MP3_320 version.

It is just a matter of seeing what deezer-downloader is doing and port the code from Go.

@kmille
Copy link
Owner

kmille commented Mar 17, 2024

I haven't looked at the project but it's good to know that 320 kbit/s downloads work. I currently don't want to put effort into this project. But pull requests are welcome, so feel free to fix the code :)

This was referenced Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests