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

[YandexMusic] downloads music in High Quality (320 Kbit/s) #31159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smusatov
Copy link

@smusatov smusatov commented Aug 11, 2022

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Improved the Yandex Music extractor: if cookies with authorization from a premium account are specified, then the extracted URL refers to High Quality (320 kbps)

@dirkf
Copy link
Contributor

dirkf commented Aug 11, 2022

As we can't easily test this enhancement, please post logs showing this working: ideally one showing what happens with the existing code and one showing what happens with the PR code.

@ursval
Copy link

ursval commented Feb 25, 2023

May I suggest test case?
High quality in terms of Yandex means lower mp3 compression and higher bitrate.
So, these are steps to prove that after this improvement downloaded file has higher quality:

  1. Download some modern file
  2. Run spectrum analyzer on it. For example, Audacity. Menus: Analyze -> Plot Spectrum
  3. Compare maximum frequency
    It is typical for higher-rate compression to cut higher-rate frequencies
    So, we can tell that audio analyzed on firs image has higher compression rate that second one (see "cursor" field for edge frequency value).
    image
    image

I think, this proof is quite sufficient.

Experiment can be reproduced on song
https://music.yandex.ru/album/1891713/track/17190963

@dirkf
Copy link
Contributor

dirkf commented Feb 25, 2023

Or just run ffprobe or mediainfo on the audio file.

@unkernet
Copy link

I think this should be accepted.

Without this patch:

python3 -m youtube_dl -F --cookies ~/music.yandex.ru_cookies.txt https://music.yandex.ru/album/1891713/track/17190963
[yandexmusic:track] 17190963: Downloading track JSON
[yandexmusic:track] 17190963: Downloading track location url JSON
[yandexmusic:track] 17190963: Downloading track location JSON
[info] Available formats for 17190963:
format code  extension  resolution note
0            mp3        unknown    mp3  @192k, 0.00B

With this patch:

python3 -m youtube_dl -F --cookies ~/music.yandex.ru_cookies.txt https://music.yandex.ru/album/1891713/track/17190963 
[yandexmusic:track] 17190963: Downloading track JSON
[yandexmusic:track] 17190963: Downloading track location url JSON
[yandexmusic:track] 17190963: Downloading track location JSON
[info] Available formats for 17190963:
format code  extension  resolution note
0            mp3        unknown    mp3  @320k, 0.00B

With patch, without cookies

python3 -m youtube_dl -F https://music.yandex.ru/album/1891713/track/17190963
[yandexmusic:track] 17190963: Downloading track JSON
[yandexmusic:track] 17190963: Downloading track location url JSON
[yandexmusic:track] 17190963: Downloading track location JSON
[info] Available formats for 17190963:
format code  extension  resolution note
0            mp3        unknown    mp3  @128k, 0.00B

ffprobe

ffprobe -i "The Doors - People Are Strange-17190963.mp3" 
Input #0, mp3, from 'The Doors - People Are Strange-17190963.mp3':
  Duration: 00:02:12.73, start: 0.000000, bitrate: 320 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s

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

Successfully merging this pull request may close these issues.

None yet

4 participants