parseAlbumSong static method

SongDetailed parseAlbumSong(
  1. dynamic item,
  2. ArtistBasic artistBasic,
  3. AlbumBasic albumBasic,
  4. List<ThumbnailFull> thumbnails,
)

Implementation

static SongDetailed parseAlbumSong(
  dynamic item,
  ArtistBasic artistBasic,
  AlbumBasic albumBasic,
  List<ThumbnailFull> thumbnails,
) {
  final title = traverseList(item, ["flexColumns", "runs"])
      .firstWhere(isTitle, orElse: () => null);
  final duration = traverseList(item, ["fixedColumns", "runs"])
      .firstWhere(isDuration, orElse: () => null);

  return SongDetailed(
    type: "SONG",
    videoId: traverseString(item, ["playlistItemData", "videoId"]) ?? '',
    name: traverseString(title, ["text"]) ?? '',
    artist: artistBasic,
    album: albumBasic,
    duration: Parser.parseDuration(duration?['text']),
    thumbnails: thumbnails,
  );
}