Skip to main content
.NETStandard2.0

A library aimed at searching, resolving and getting direct links to tracks, playlists or albums in Yandex.Music. Can work without authorization.

Published
Aug 9, 2024
2y ago
Total Downloads
11.4K
11,363

Install

dotnet add package YandexMusicResolver --version 6.0.0-preview1
ProductVersions
.NET Standard
netstandard2.0

README

YandexMusicResolver

A library aimed at searching, resolving and getting direct links to tracks, playlists or albums in Yandex.Music.
Can work without authorization.

Getting started

  1. Add nuget package to your project:

    dotnet add package YandexMusicResolver
    
  2. Create auth service instance (YandexMusicAuthService this is the default implementation):

    var authService = new YandexMusicAuthService(httpClient);
    

    Actually, preferred way is to use IHttpClientFactory to pass it to all services. If you use IHttpClientFactory default HttpClient name is YandexMusic.

  3. Create credentials provider instance (YandexCredentialsProvider this is the default implementation):

    var credentialProvider = new YandexMusicAuthService(authService, "Login", "Pass");
    
  4. Create an instance of YandexMusicMainResolver and pass config to it

    var yandexMusicMainResolver = new YandexMusicMainResolver(credentialProvider, httpClient);
    

    After that we can use YandexMusicMainResolver methods and other loaders methods.

Example code for getting direct track download url:

var httpClient = new HttpClient();
var authService = new YandexMusicAuthService(httpClient);
var credentialProvider = new YandexMusicAuthService(authService, "Login", "Pass");
var yandexMusicMainResolver = new YandexMusicMainResolver(credentialProvider, httpClient);
var directUrl = await yandexMusicMainResolver.DirectUrlLoader.GetDirectUrl("55561798");
Console.WriteLine(directUrl);

Warn: Yandex will return a link to a 30-seconds track if you do not log in (do not use a config with a valid token).

You can take a look at unit test project for additional examples.

Changes from Previous Version

No structural changes between v5.1.0 and v6.0.0-preview1.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.