parseArtistTopSong static method
Implementation
static SongDetailed parseArtistTopSong(
dynamic item, ArtistBasic artistBasic) {
final columns = traverseList(item, ["flexColumns", "runs"])
.expand((e) => e is List ? e : [e])
.toList();
final title = columns.firstWhere(isTitle, orElse: () => null);
final album = columns.firstWhere(isAlbum, orElse: () => null);
return SongDetailed(
type: "SONG",
videoId: traverseString(item, ["playlistItemData", "videoId"]) ?? '',
name: traverseString(title, ["text"]) ?? '',
artist: artistBasic,
album: album != null
? AlbumBasic(
name: traverseString(album, ["text"]) ?? '',
albumId: traverseString(album, ["browseId"]) ?? '',
)
: null,
duration: null,
thumbnails: traverseList(item, ["thumbnails"])
.map((item) => ThumbnailFull.fromMap(item))
.toList(),
);
}