internal static YSearchArtistModel FromJson(JToken json) { if (json == null) { return(null); } return(new YSearchArtistModel { Id = json.SelectToken("id")?.ToObject <string>(), Name = json.SelectToken("name")?.ToObject <string>(), Cover = YCover.FromJson(json.SelectToken("cover")), Composer = json.SelectToken("composer")?.ToObject <bool>(), Various = json.SelectToken("various")?.ToObject <bool>(), Counts = YSearchArtistCounter.FromJson(json.SelectToken("counts")), Genres = json.SelectToken("genres")?.Select(x => x.ToObject <string>()).ToList(), TicketsAvailable = json.SelectToken("ticketsAvailable")?.ToObject <bool>(), PopularTracks = json.SelectToken("popularTracks")?.Select(x => YSearchTrackModel.FromJson(x)).ToList(), Regions = json.SelectToken("regions")?.Select(x => x.ToObject <string>()).ToList() }); }
private string BuildUri(YSearchTrackModel track) { //https://music.yandex.ru/album/3258239/track/3736259 return(string.Concat(@"https://music.yandex.ru/album/", track.Albums.First().Id, "/track/", track.Id)); }