miraclx / freyr-js

A tool for downloading songs from music streaming services like Spotify and Apple Music.
https://git.io/freyr-js
Apache License 2.0
1.53k stars 95 forks source link

FLAC Audio Quality Support #75

Open Vostro-08 opened 3 years ago

Vostro-08 commented 3 years ago

Thanks for this awesome project. Am trying to find out a way to download FLAC Quality audio with Spotify link. Could you please help me with the syntax?

Thank you!

miraclx commented 3 years ago

Hey, so as of the time of writing, freyr doesn't support FLAC quality.

While this was a feature that was planned from the start and was in the works, it was never incorporated. However, contributions are welcome. It would certainly be a great addition.

A way this could work is to source audio from either Tidal or Deezer. It's clear it's doable seeing as projects like https://github.com/yaronzz/Tidal-Media-Downloader already accomplish this.


Traffic on this issue could serve as a poll for whether this should be implemented down the line and please go ahead if you think this is something you could work on.

Vostro-08 commented 3 years ago

I have a limited knowledge in this section mate. But it is possible to add FLAC support either by Tidal/Deezer. The tagged repo needs a premium tidal subscription while certain other repos in the same league make use of Deezer's ARL Token to get the FLAC Audio. You may know about this already! If you need any reference Repo for further dig, reply to this message and I will give the links. Btw I asked about this syntax bcoz I seen the flac format flag in the -get subcommand list.

miraclx commented 3 years ago

I suppose you mean the -x, --format <FORMAT> flag

  -x, --format <FORMAT>        preferred audio output format (to export) (unimplemented)
                               (valid: mp3,m4a,flac) (default: "m4a")

Emphasis on (unimplemented). I agree this isn't the best way, but at the time of active development, it was going to be worked on, so it made sense to reserve the flag. We could clean up all the flags tagged unimplemented to make this clearer.

Vostro-08 commented 3 years ago

Ha, Okay! Btw there is a bad news. Latest patch to Deezer added a few breaking changes which prevent most of the projects from being able to stream/download FLAC quality audio. So actually, it wasn't just a minor patch by Deezer, but a big one. Deezer has officially patched old URL generator and added new server-side one (requires premium/hifi account). So it is no longer able to stream/download FLAC for free.

miraclx commented 3 years ago

Ah, I see.. That's certainly a bummer. Regardless, having it implemented even if it's exclusive to premium users only would still be a tremendous upside and is a way to go. In this regard, I'll tag this issue help wanted in case anyone in the future might want to lend a hand. I, currently don't have much time to dig into this.

Vostro-08 commented 3 years ago

Ok then! Thanks for your reply pal. You can close this issue if you want...

miraclx commented 3 years ago

Gotcha. Let's leave this open as a tracking issue for future FLAC implementation.

lynatic1337 commented 2 years ago

As every supported service (except YouTube Music and Spotify) now has got FLAC support, I'd like to ask for an updated opinion on this.

Also you can technically download lossless from Apple Music much cheaper than by paying full subscription by getting iTunes Match für 25$/year (~2$/Month) and then grabbing some Indian YouTube tutorial-quality file you ripped from Spotify while specifying the lowest fucking bitrate on earth and uploading it to iTunes Match. iTunes Match will return a lossless audio file in any case.

I'd actually like to help develop the latter feature but I'm not well versed in the secrets of the iTunes APIs so not sure if I can help there.

miraclx commented 2 years ago

@AgentHV I haven't personally used iTunes match yet, to clarify when you say;

iTunes Match will return a lossless audio file in any case.

Do you mean it points you to an Apple Music track, or it actually returns a URL from which you can rip lossless audio from?

lynatic1337 commented 2 years ago

Do you mean it points you to an Apple Music track, or it actually returns a URL from which you can rip lossless audio from?

@miraclx Sorry for the late answer. Apparently, iTunes Match adds a song's license to your iTunes library for the duration of your subscription. Apple allows this because by having the mp3 you "prove" ownership. So the workflow would be:

  1. Get low quality song rip from yt/spotify
  2. Upload it to iTunes Match API
  3. Get recognized song in response
  4. Download recognized song from library
  5. Decode DRMed song, maybe convert to FLAC

About FLAC from Apple Music in general: FLAC support for Apple Music would be great because they are the only service having most tracks in their library while also supporting high bitrate lossless. Deezer HiFi is limited to 16 bit depth (44khz) while Tidal doesn't have licenses for most songs (or only for the artist's country). Therefore Apple Music would be the best platform to download lossless from as they offer 24 bit depth (->192khz). However there is no Apple Music downloader yet...

fabriguzden commented 2 years ago

Do you mean it points you to an Apple Music track, or it actually returns a URL from which you can rip lossless audio from?

@miraclx Sorry for the late answer. Apparently, iTunes Match adds a song's license to your iTunes library for the duration of your subscription. Apple allows this because by having the mp3 you "prove" ownership. So the workflow would be:

  1. Get low quality song rip from yt/spotify
  2. Upload it to iTunes Match API
  3. Get recognized song in response
  4. Download recognized song from library
  5. Decode DRMed song, maybe convert to FLAC

About FLAC from Apple Music in general: FLAC support for Apple Music would be great because they are the only service having most tracks in their library while also supporting high bitrate lossless. Deezer HiFi is limited to 16 bit depth (44khz) while Tidal doesn't have licenses for most songs (or only for the artist's country). Therefore Apple Music would be the best platform to download lossless from as they offer 24 bit depth (->192khz). However there is no Apple Music downloader yet...

a few days ago a script that downloads music and videos from apple music using cdm and widevine has just been leaked but the bad thing apparently does not download alac, maybe you could add that support at some point

miraclx commented 2 years ago

@fabriguzden that's interesting, do you mind linking me to the source?

fabriguzden commented 2 years ago

@fabriguzden that's interesting, do you mind linking me to the source?

https://github.com/SASUKE-DUCK/AppleMusic-Downloader if you manage to download alac, and if you decide not to make it public for any reason, please share it with me please, it would be private by telegram pm

fabriguzden commented 2 years ago

but I recommend that you download and try this one that is fixed since the original has small problems If you want to try it, you just have to install the requirements that are written in readme.md https://drive.google.com/drive/folders/1jXRPuEDXiWFS3tAahpqTG6Dc52HSRaf4?usp=sharing

miraclx commented 2 years ago

This looks really good. Props to them for figuring this out and to you for linking to it. I'll keep this as a milestone for us to replicate but as of the moment, I personally don't have the bandwidth to implement this.

ikhtiarsobhan commented 3 weeks ago

Do you mean it points you to an Apple Music track, or it actually returns a URL from which you can rip lossless audio from?

@miraclx Sorry for the late answer. Apparently, iTunes Match adds a song's license to your iTunes library for the duration of your subscription. Apple allows this because by having the mp3 you "prove" ownership. So the workflow would be:

1. Get low quality song rip from yt/spotify

2. Upload it to iTunes Match API

3. Get recognized song in response

4. Download recognized song from library

5. Decode DRMed song, maybe convert to FLAC

About FLAC from Apple Music in general: FLAC support for Apple Music would be great because they are the only service having most tracks in their library while also supporting high bitrate lossless. Deezer HiFi is limited to 16 bit depth (44khz) while Tidal doesn't have licenses for most songs (or only for the artist's country). Therefore Apple Music would be the best platform to download lossless from as they offer 24 bit depth (->192khz). However there is no Apple Music downloader yet...

Apple Music has the iTunes Match functionality built in. You can download a 256kb aac (.m4a) version of a music track if you can prove you already own the music track. So, you can add a music track by downloading it from YT/Spotify and adding it to your music library. Apple Music will scan it and will allow you to download the 256kb aac which is DRM-free. Unfortunately, it will not allow you to download the ALAC version.

To get a DRM Free ALAC version, you need to purchase that track.

deton24 commented 3 weeks ago

Qobuz also has hi-res files.

wt., 10 wrz 2024 o 17:07 Ikhtiar Sobhan @.***> napisał(a):

Do you mean it points you to an Apple Music track, or it actually returns a URL from which you can rip lossless audio from?

@miraclx https://github.com/miraclx Sorry for the late answer. Apparently, iTunes Match adds a song's license to your iTunes library for the duration of your subscription. Apple allows this because by having the mp3 you "prove" ownership. So the workflow would be:

  1. Get low quality song rip from yt/spotify

  2. Upload it to iTunes Match API

  3. Get recognized song in response

  4. Download recognized song from library

  5. Decode DRMed song, maybe convert to FLAC

About FLAC from Apple Music in general: FLAC support for Apple Music would be great because they are the only service having most tracks in their library while also supporting high bitrate lossless. Deezer HiFi is limited to 16 bit depth (44khz) while Tidal doesn't have licenses for most songs (or only for the artist's country). Therefore Apple Music would be the best platform to download lossless from as they offer 24 bit depth (->192khz). However there is no Apple Music downloader yet...

Apple Music has the iTunes Match functionality built in. You can download a 256kb aac (.m4a) version of a music track if you can prove you already own the music track. So, you can add a music track by downloading it from YT/Spotify and adding it to your music library. Apple Music will scan it and will allow you to download the 256kb aac which is DRM-free. Unfortunately, it will not allow you to download the ALAC version.

To get a DRM Free ALAC version, you need to purchase that track.

— Reply to this email directly, view it on GitHub https://github.com/miraclx/freyr-js/issues/75#issuecomment-2341192368, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJ3EHE2WYMFQWDJDJ75TDLZV4DLLAVCNFSM6AAAAABN67NGR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRGE4TEMZWHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>