Fix GetTrackDownloadInfo to return signed download URLs

- Pass quality parameter to /tracks/{track_id}/download-info API request
- Add GetTrackDownloadURL method that resolves signed download URLs by
  downloading XML from download_info_url, parsing host/path/ts/s,
  computing MD5 signature (salt: XGRlBW9FXlekgbPrRHuSiA), and
  returning https://{host}/get-mp3/{sign}/{ts}{path}
- Add DownloadInfoURL field to DownloadInfo model for the XML URL
- Update DownloadTrack to use GetDirectLink resolution when URL is empty
- Port signing logic from yandex-music-api-python download_info.py
This commit is contained in:
Mrixs committed 2026-10-18 12:13:54 +03:00
1 parent dbb823ade3
commit ad83d84531
2 files changed
+101 -17

No files matched your search

+8 -6
View File
@@ -165,10 +165,12 @@ type TrackLyricsInfo struct {
// DownloadInfo represents file download info for a track.
type DownloadInfo struct {
Quality string `json:"quality"`
Codec string `json:"codec"`
Bitrate int `json:"bitrate"`
Size int64 `json:"size"`
URL string `json:"url"`
DirectLink bool `json:"direct_link"`
Quality string `json:"quality"`
Codec string `json:"codec"`
Bitrate int `json:"bitrate"`
Size int64 `json:"size"`
URL string `json:"url"`
DirectLink bool `json:"direct_link"`
DownloadInfoURL string `json:"download_info_url"`
DirectLinkURL string `json:"-"` // Computed signed download URL
}