parseSearchResult static method
Implementation
static AlbumDetailed parseSearchResult(dynamic item) {
final columns = traverseList(item, ["flexColumns", "runs"])
.expand((e) => e is List ? e : [e])
.toList();
// No specific way to identify the title
final title = columns[0];
final artist = columns.firstWhere(isArtist, orElse: () => columns[3]);
final playlistId = traverseString(item, ["overlay", "playlistId"]) ??
traverseString(item, ["thumbnailOverlay", "playlistId"]);
return AlbumDetailed(
type: "ALBUM",
albumId: traverseList(item, ["browseId"]).last,
playlistId: playlistId ?? '',
artist: ArtistBasic(
name: traverseString(artist, ["text"]) ?? '',
artistId: traverseString(artist, ["browseId"]),
),
year: processYear(columns.last?['text']),
name: traverseString(title, ["text"]) ?? '',
thumbnails: traverseList(item, ["thumbnails"])
.map((item) => ThumbnailFull.fromMap(item))
.toList(),
);
}