Open ant0nk opened 2 years ago
Presumably there is a preview track as well as the wanted track, and the extractor is incorrectly finding the first instead of the second.
Please use --write-pages
, zip and attach.
https://music.yandex.com/api/v2.1/handlers/track/%s:%s/web-artist_tracks-track-track-saved/download/m
there a bit different url, as well as, seems like using yandex.com provides full tracks, whilst yandex.ru provides only previews. not sure about cookies being useful here or not. but this fix makes it work for me.
@ant0nk, @dirkf
but this fix makes it work for me. @nartes I'm sorry but which fix are you referring to?
@nartes I'm sorry but which fix are you referring to? Suppose, that changing to .com in url is that fix. Because neither .ru nor .by domains worked normally for me. After logging to music.yandex.com and using cookies I've finally got full tracks
The dump shows this:
{
's': '8281c523dc2d6608ceeb6903a083d93eb410ded7e451fa8bdb17924c12f84378',
'ts': '0005dc5accde8223',
'path': '/rmusic/U2FsdGVkX1-JUGfdZkhlizJD4ezmxa7Ct0GSiKV5hx30aGSA7W76LO8_hrcRtH6a_b9wV62vqk8b179F0K48NsbYbiDmtyE0Mkstaj1Jtg4/8281c523dc2d6608ceeb6903a083d93eb410ded7e451fa8bdb17924c12f84378',
'host': 's59iva.storage.yandex.net'
}
And this:
{
'codec': 'mp3',
'bitrate': 128,
'src': '//storage.mds.yandex.net/file-download-info/1766897_d11315d5.90864038.5.61099558/preview?sign=a29ee6e874a643f5c6e06c0786d82b163bd342c2c05365f91e356ac1830ff238&ts=6253b87d',
'gain': false,
'preview': true
}
Plus a JSON with artists
data and data for track
61099558
, but no media links.
I tried the proposed work-around but had 403 either way: maybe an account from --cookies ...
is needed:
--- old/youtube_dl/extractor/yandexmusic.py
+++ new/youtube_dl/extractor/yandexmusic.py
@@ -118,7 +118,7 @@
track_title = track['title']
download_data = self._download_json(
- 'https://music.yandex.ru/api/v2.1/handlers/track/%s:%s/web-album_track-track-track-main/download/m' % (track_id, album_id),
+ 'https://music.yandex.com/api/v2.1/handlers/track/%s:%s/web-artist_tracks-track-track-saved/download/m' % (track_id, album_id),
track_id, 'Downloading track location url JSON',
headers={'X-Retpath-Y': url})
--- old/youtube_dl/extractor/yandexmusic.py
+++ new/youtube_dl/extractor/yandexmusic.py
@@ -114,7 +114,7 @@
track_title = track['title']
download_data = self._download_json(
- 'https://music.yandex.ru/api/v2.1/handlers/track/%s:%s/web-album_track-track-track-main/download/m' % (track_id, album_id),
+ 'https://music.yandex.ru/api/v2.1/handlers/track/%s:%s/web-label_albums-album-track-fridge/download/m' % (track_id, album_id),
track_id, 'Downloading track location url JSON', query={'hq': 1}, headers={'X-Retpath-Y': url})
fd_data = self._download_json(
This patch works for me
Cookie(s) required?
Yes cookies requred. Without cookies only 30sec demo.
Checklist
Verbose log
Description
Attempt to download from Yandex music gives only 30 seconds even with cookies provided. Cookies file have proper format: