getUploadsFromPage method

Future<ChannelUploadsList> getUploadsFromPage(
  1. dynamic channelId, {
  2. VideoSorting videoSorting = VideoSorting.newest,
  3. VideoType videoType = VideoType.normal,
})

Enumerates videos uploaded by the specified channel. This fetches thru all the uploads pages of the channel.

Use .nextPage() to fetch the next batch of videos.

Implementation

Future<ChannelUploadsList> getUploadsFromPage(
  dynamic channelId, {
  VideoSorting videoSorting = VideoSorting.newest,
  VideoType videoType = VideoType.normal,
}) async {
  channelId = ChannelId.fromString(channelId);
  final page = await ChannelUploadPage.get(
    _httpClient,
    (channelId as ChannelId).value,
    videoSorting.code,
    videoType,
  );

  final channel = await get(channelId);

  return ChannelUploadsList(
    page.uploads
        .map(
          (e) => Video(
            e.videoId,
            e.videoTitle,
            channel.title,
            channelId,
            e.videoUploadDate.toDateTime(),
            e.videoUploadDate,
            null,
            '',
            e.videoDuration,
            ThumbnailSet(e.videoId.value),
            null,
            Engagement(e.videoViews, null, null),
            false,
          ),
        )
        .toList(),
    channel.title,
    channelId,
    page,
    _httpClient,
  );
}