Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Track.GetDownloadInfoWithToken(string trackId)

KirMozor edited this page May 11, 2022 · 1 revision

Returns information about downloading a file. Can I download. What is the quality? Requiring token

Example:

using System;
using System.Linq;
using Newtonsoft.Json.Linq;
using YandexMusicApi;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Token.token = "YOURTOKEN";
            
            
            JObject result = Track.GetDownloadInfoWithToken("34976783"); //IdTrack: Imagine Dragons

            
            var resultData = result.GetValue("result");
            resultData = resultData[0];
            foreach (var i in resultData.ToList())
            {
                Console.WriteLine(i);
            }
        }
    }
}

Output:

{
  "invocationInfo": {
    "req-id": "567h457j48579je679ke79e759kk9e6k",
    "hostname": "music-stable-back-vla-30.vla.yp-c.yandex.net",
    "exec-duration-millis": 1
  },
  "result": [
    {
      "codec": "mp3",
      "gain": false,
      "preview": false,
      "downloadInfoUrl": "https://storage.mds.yandex.net/file-download-info/1751270_2f9bf813.107036630.1.34976783/2?sign=b9212e168f9cfbc8cea4a4f0d23c60cf356a020696f3f01f793af0874ca194fb&ts=627bfd03&offset=29427",
      "direct": false,
      "bitrateInKbps": 192
    },
    {
      "codec": "mp3",
      "gain": false,
      "preview": false,
      "downloadInfoUrl": "https://storage.mds.yandex.net/file-download-info/1751270_2f9bf813.107036630.5.34976783/320?sign=8ab1a388b3140cee80322dec0d98cf8052c12c8092ad14824cce0d3a87e97123&ts=627bfd03&offset=29439",
      "direct": false,
      "bitrateInKbps": 320
    },
    {
      "codec": "aac",
      "gain": true,
      "preview": false,
      "downloadInfoUrl": "https://storage.mds.yandex.net/file-download-info/1751270_2f9bf813.107036630.9.34976783/g128?sign=9575143255600198d291b00887060b5663d887219a291f6cedfa707977e7648d&ts=627bfd03",
      "direct": false,
      "bitrateInKbps": 128
    }
  ]
}

Clone this wiki locally