Release 1.0.0.3: fix artist wrapper and lyrics fallback

This commit is contained in:
1xDed committed 2026-11-27 19:17:00 +03:00
1 parent 16515c5166
commit 84e3ea34c8
10 files changed
+92 -13

No files matched your search

@@ -154,11 +154,11 @@ public sealed class YandexMusicClient
/// <summary>Gets an artist by id.</summary>
public async Task<ArtistDto?> GetArtistAsync(long id, CancellationToken cancellationToken)
{
var response = await GetJsonAsync<YandexResponse<ArtistDto>>(
var response = await GetJsonAsync<YandexResponse<ArtistDetailResponse>>(
string.Format(CultureInfo.InvariantCulture, "/artists/{0}", id),
false,
cancellationToken).ConfigureAwait(false);
return response?.Result;
return response?.Result?.Artist;
}
/// <summary>Gets the extended artist card (bio, covers, links).</summary>
@@ -300,6 +300,31 @@ public sealed class YandexMusicClient
}
}
/// <summary>
/// Gets plain lyrics from the track supplement endpoint. Works even though the signed
/// /lyrics endpoint currently rejects signatures with "Invalid Sign".
/// </summary>
public async Task<string?> GetSupplementLyricsAsync(long trackId, CancellationToken cancellationToken)
{
if (Token is null || !Config.EnableLyrics)
{
return null;
}
var response = await GetJsonAsync<SupplementResponse>(
string.Format(CultureInfo.InvariantCulture, "/tracks/{0}/supplement", trackId),
true,
cancellationToken).ConfigureAwait(false);
var text = response?.Result?.Lyrics?.FullLyrics;
if (string.IsNullOrWhiteSpace(text))
{
text = response?.Result?.Lyrics?.Lyrics;
}
return string.IsNullOrWhiteSpace(text) ? null : text.TrimStart('\uFEFF', '\u200B', ' ', '\r', '\n');
}
/// <summary>Downloads an image from an allowed Yandex host.</summary>
public async Task<byte[]?> GetImageBytesAsync(string url, CancellationToken cancellationToken)
{