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.37k stars 89 forks source link

feat(Deezer): workaround for fetching copyright & total disk number #639

Closed miraclx closed 5 months ago

miraclx commented 5 months ago

https://github.com/miraclx/freyr-js/pull/634/#issue-2080542052 highlighted an alternative API for Deezer that provides copyright information as well as disk numbers for all tracks in the album.

The implementation in this PR makes Deezer feature complete.

There's an alt-API we could use for this (which also provides us copyright information)

$ xh 'https://www.deezer.com/ajax/gw-light.php?method=deezer.getUserData&api_version=1.0&api_token=' \
  | jq '{cf: .results.checkForm, sid: .results.SESSION_ID}'
{
  "cf": "8MBdPkLVd3V~Exj0gJP0chXXXgM~2yb0",
  "sid": "fr0f7920da51b1f2b72dbbc7052a4a4141872d94"
}

$ xh 'https://www.deezer.com/ajax/gw-light.php?method=deezer.pageAlbum&api_version=1.0&api_token=8MBdPkLVd3V~Exj0gJP0chXXXgM~2yb0' \
    cookie:sid=fr0f7920da51b1f2b72dbbc7052a4a4141872d94 \
    alb_id:=264169542 lang=us \
  | jq -r '{total_discs: [.results.SONGS.data[] | .DISK_NUMBER] | unique | sort | reverse[0], copyright: .results.DATA.PRODUCER_LINE}'
{
  "total_discs": "3",
  "copyright": "(P) 2021 Floating World LTD"
}
github-actions[bot] commented 5 months ago
--- 🐋 🤖 **A docker image for this PR has been built!** ```console docker pull freyrcli/freyrjs-git:pr-639 ``` | [**Base (master)**][base-url] | [![](https://img.shields.io/docker/image-size/freyrcli/freyrjs-git/437c505?color=gray&label=%20&logo=docker)][base-url] | | :-: | - | | [**This Patch**][pr-url] | [![](https://img.shields.io/docker/image-size/freyrcli/freyrjs-git/pr-639?color=gray&label=%20&logo=docker)][pr-url] | [![][compare-img]][compare-url] ---
What's this? This docker image is a self-contained sandbox that includes all the patches made in this PR. Allowing others to easily use your patches without waiting for it to get merged and released officially. For more context, see https://github.com/miraclx/freyr-js#docker-development.