From e1e3fec37d2656f72da9af3fc007a75fdaeeadf3 Mon Sep 17 00:00:00 2001 From: "Michael J. Miller" Date: Tue, 23 Mar 2021 23:17:49 -0600 Subject: [PATCH] Adds video.publishDate --- lib/src/playlists/playlist_client.dart | 1 + .../responses/player_response.dart | 7 +++++++ lib/src/search/search_client.dart | 2 +- lib/src/search/search_list.dart | 15 +++++++++++++-- lib/src/videos/video.dart | 4 ++++ lib/src/videos/video_client.dart | 1 + 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/src/playlists/playlist_client.dart b/lib/src/playlists/playlist_client.dart index 130efdd..8279964 100644 --- a/lib/src/playlists/playlist_client.dart +++ b/lib/src/playlists/playlist_client.dart @@ -58,6 +58,7 @@ class PlaylistClient { video.author, ChannelId(video.channelId), null, + null, video.description, video.duration, ThumbnailSet(videoId), diff --git a/lib/src/reverse_engineering/responses/player_response.dart b/lib/src/reverse_engineering/responses/player_response.dart index d35c43f..9361eeb 100644 --- a/lib/src/reverse_engineering/responses/player_response.dart +++ b/lib/src/reverse_engineering/responses/player_response.dart @@ -34,6 +34,13 @@ class PlayerResponse { .getT('uploadDate')! .parseDateTime(); + /// + DateTime get videoPublishDate => root + .get('microformat')! + .get('playerMicroformatRenderer')! + .getT('publishDate')! + .parseDateTime(); + /// String get videoChannelId => root.get('videoDetails')!.getT('channelId')!; diff --git a/lib/src/search/search_client.dart b/lib/src/search/search_client.dart index 106f465..bb55354 100644 --- a/lib/src/search/search_client.dart +++ b/lib/src/search/search_client.dart @@ -27,7 +27,7 @@ class SearchClient { return SearchList( page.initialData.searchContent .whereType() - .map((e) => Video(e.id, e.title, e.author, null, e.uploadDate?.toDateTime(), e.description, e.duration.toDuration(), + .map((e) => Video(e.id, e.title, e.author, null, e.uploadDate?.toDateTime(), null, e.description, e.duration.toDuration(), ThumbnailSet(e.id.value), null, Engagement(e.viewCount, null, null), e.isLive)) .toList(), page, diff --git a/lib/src/search/search_list.dart b/lib/src/search/search_list.dart index 87d904d..b3dd5b8 100644 --- a/lib/src/search/search_list.dart +++ b/lib/src/search/search_list.dart @@ -23,8 +23,19 @@ class SearchList extends DelegatingList