fix: add support for upcoming channel videos

This commit is contained in:
ThetaDev 2022-09-27 17:11:01 +02:00
parent 49f3aa3577
commit 2254b79cd6
10 changed files with 13183 additions and 8 deletions

View file

@ -205,6 +205,7 @@ async fn channel_videos(testfiles: &Path) {
("shorts", "UCh8gHdtzO2tXd593_bjErWg"), // shorts and livestreams are rendered differently
("live", "UChs0pSaEoNLV4mevBFGaoKA"),
("empty", "UCxBa895m48H5idw5li7h-0g"),
("upcoming", "UCcvfHa-GHSOHFAjU0-Ie57A"),
] {
let mut json_path = testfiles.to_path_buf();
json_path.push("channel");

View file

@ -1,4 +1,5 @@
use anyhow::{anyhow, bail, Result};
use chrono::TimeZone;
use serde::Serialize;
use url::Url;
@ -325,6 +326,7 @@ fn map_videos(
let is_live = toverlays.is_live();
let is_short = toverlays.is_short();
let to = toverlays.try_swap_remove(0);
Some(ChannelVideo {
id: video.video_id,
title: video.title,
@ -334,15 +336,26 @@ fn map_videos(
}),
thumbnail: video.thumbnail.into(),
publish_date: video
.published_time_text
.upcoming_event_data
.as_ref()
.and_then(|txt| timeago::parse_timeago_or_warn(lang, txt, &mut warnings)),
.map(|upc| {
chrono::Local.from_utc_datetime(&chrono::NaiveDateTime::from_timestamp(
upc.start_time,
0,
))
})
.or_else(|| {
video.published_time_text.as_ref().and_then(|txt| {
timeago::parse_timeago_or_warn(lang, txt, &mut warnings)
})
}),
publish_date_txt: video.published_time_text,
view_count: video
.view_count_text
.map(|txt| util::parse_numeric(&txt).unwrap_or_default()),
is_live,
is_short,
is_upcoming: video.upcoming_event_data.is_some(),
})
}
response::VideoListItem::ContinuationItemRenderer {
@ -632,6 +645,7 @@ mod tests {
#[case::shorts("shorts", "UCh8gHdtzO2tXd593_bjErWg")]
#[case::live("live", "UChs0pSaEoNLV4mevBFGaoKA")]
#[case::empty("empty", "UCxBa895m48H5idw5li7h-0g")]
#[case::upcoming("upcoming", "UCcvfHa-GHSOHFAjU0-Ie57A")]
fn t_map_channel_videos(#[case] name: &str, #[case] id: &str) {
let filename = format!("testfiles/channel/channel_videos_{}.json", name);
let json_path = Path::new(&filename);
@ -647,9 +661,16 @@ mod tests {
"deserialization/mapping warnings: {:?}",
map_res.warnings
);
insta::assert_ron_snapshot!(format!("map_channel_videos_{}", name), map_res.c, {
".content.items[].publish_date" => "[date]",
});
if name == "upcoming" {
insta::assert_ron_snapshot!(format!("map_channel_videos_{}", name), map_res.c, {
".content.items[1:].publish_date" => "[date]",
});
} else {
insta::assert_ron_snapshot!(format!("map_channel_videos_{}", name), map_res.c, {
".content.items[].publish_date" => "[date]",
});
}
}
#[test]

View file

@ -105,6 +105,8 @@ pub struct GridVideoRenderer {
/// Contains video length
#[serde_as(as = "VecSkipError<_>")]
pub thumbnail_overlays: Vec<TimeOverlay>,
/// Release date for upcoming videos
pub upcoming_event_data: Option<UpcomingEventData>,
}
/// Video displayed in recommendations
@ -166,6 +168,15 @@ pub struct GridPlaylistRenderer {
pub video_count_short_text: String,
}
#[serde_as]
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UpcomingEventData {
/// Unixtime in seconds
#[serde_as(as = "JsonString")]
pub start_time: i64,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinuationItemRenderer {

View file

@ -175,6 +175,7 @@ Channel(
view_count: Some(19739),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "WHO8NBfpaO0",
@ -207,6 +208,7 @@ Channel(
view_count: Some(24194),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "W1Q8CxL95_Y",
@ -239,6 +241,7 @@ Channel(
view_count: Some(51443),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "lagxSrPeoYg",
@ -271,6 +274,7 @@ Channel(
view_count: Some(72324),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "qTctWW9_FmE",
@ -303,6 +307,7 @@ Channel(
view_count: Some(57348),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "3t9G80wk0pk",
@ -335,6 +340,7 @@ Channel(
view_count: Some(68645),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "7dze5CnZnmk",
@ -367,6 +373,7 @@ Channel(
view_count: Some(91388),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "6XnrZpPYgBg",
@ -399,6 +406,7 @@ Channel(
view_count: Some(39993),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Psp3ltpFvws",
@ -431,6 +439,7 @@ Channel(
view_count: Some(22512),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "taVYTYz5vLE",
@ -463,6 +472,7 @@ Channel(
view_count: Some(40137),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Y6cZrieFw-k",
@ -495,6 +505,7 @@ Channel(
view_count: Some(74510),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Kr2XyhpUdUI",
@ -527,6 +538,7 @@ Channel(
view_count: Some(34487),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "rxGafdgkal8",
@ -559,6 +571,7 @@ Channel(
view_count: Some(44928),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "4yosozyeIP4",
@ -591,6 +604,7 @@ Channel(
view_count: Some(34324),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "06JtC2DC_dQ",
@ -623,6 +637,7 @@ Channel(
view_count: Some(63763),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "piquT76w9TI",
@ -655,6 +670,7 @@ Channel(
view_count: Some(149186),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "pKuUKT-zU-g",
@ -687,6 +703,7 @@ Channel(
view_count: Some(30130),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "_R4wQQNSO6k",
@ -719,6 +736,7 @@ Channel(
view_count: Some(48037),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "ikp5BorIo_M",
@ -751,6 +769,7 @@ Channel(
view_count: Some(81958),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "7O-QckjCXNo",
@ -783,6 +802,7 @@ Channel(
view_count: Some(42635),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "VutdTxF4E-0",
@ -815,6 +835,7 @@ Channel(
view_count: Some(25860),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "o7xfGuRaq94",
@ -847,6 +868,7 @@ Channel(
view_count: Some(63035),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "3WSIfHOv3fc",
@ -879,6 +901,7 @@ Channel(
view_count: Some(22731),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "8yXZJZCKImI",
@ -911,6 +934,7 @@ Channel(
view_count: Some(65765),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "vJ4pW6LKJWU",
@ -943,6 +967,7 @@ Channel(
view_count: Some(51555),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "myqiqUE00fo",
@ -975,6 +1000,7 @@ Channel(
view_count: Some(46638),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "xIokNnjuam8",
@ -1007,6 +1033,7 @@ Channel(
view_count: Some(62921),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "S3R4r2xvVYQ",
@ -1039,6 +1066,7 @@ Channel(
view_count: Some(66895),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "RlwcdUnRw6w",
@ -1071,6 +1099,7 @@ Channel(
view_count: Some(25894),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "R2fw2g6WFbg",
@ -1103,6 +1132,7 @@ Channel(
view_count: Some(80173),
is_live: false,
is_short: false,
is_upcoming: false,
),
],
ctoken: Some("4qmFsgKrARIYVUMyRGpGRTdYZjExVVJacVdCaWdjVk9RGmBFZ1oyYVdSbGIzTVlBeUFBTUFFNEFlb0RNRVZuYjBsMVMzWlpPVXREWWw5TVRraExSRWwzUVZSblpWRm5kMGx3ZFVOMGJWRlpVVjlOUjA1d2QwcEpRVlpCUVElM0QlM0SaAixicm93c2UtZmVlZFVDMkRqRkU3WGYxMVVSWnFXQmlnY1ZPUXZpZGVvczEwMg%3D%3D"),

View file

@ -36,6 +36,7 @@ Paginator(
view_count: Some(80296),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "JDXKrXJloSw",
@ -68,6 +69,7 @@ Paginator(
view_count: Some(36294),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "H8ot_YPi6QU",
@ -100,6 +102,7 @@ Paginator(
view_count: Some(34736),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "i1Ad5jfk_v4",
@ -132,6 +135,7 @@ Paginator(
view_count: Some(73544),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "GHbo4v8pahc",
@ -164,6 +168,7 @@ Paginator(
view_count: Some(67231),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Uds-wLoaZmA",
@ -196,6 +201,7 @@ Paginator(
view_count: Some(44946),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "D9J-AmCcf4U",
@ -228,6 +234,7 @@ Paginator(
view_count: Some(43264),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Eoh-JKVQZwg",
@ -260,6 +267,7 @@ Paginator(
view_count: Some(98175),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "U81glZBDpIg",
@ -292,6 +300,7 @@ Paginator(
view_count: Some(59376),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "gLfxznVJ2q0",
@ -324,6 +333,7 @@ Paginator(
view_count: Some(25496),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "GfihUkWPCQQ",
@ -356,6 +366,7 @@ Paginator(
view_count: Some(22982),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "yEG6pKUdIlg",
@ -388,6 +399,7 @@ Paginator(
view_count: Some(38804),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "wPzzPGzxD00",
@ -420,6 +432,7 @@ Paginator(
view_count: Some(25505),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "Tdge8vEODeY",
@ -452,6 +465,7 @@ Paginator(
view_count: Some(98432),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "ebQ2Im5zfT0",
@ -484,6 +498,7 @@ Paginator(
view_count: Some(53410),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "UrS5ezesA9s",
@ -516,6 +531,7 @@ Paginator(
view_count: Some(54771),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "c5M8P6oe9xY",
@ -548,6 +564,7 @@ Paginator(
view_count: Some(39823),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "9TDKP9RLlPs",
@ -580,6 +597,7 @@ Paginator(
view_count: Some(51596),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "hwggIw2HQuQ",
@ -612,6 +630,7 @@ Paginator(
view_count: Some(125391),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "xzSDJRC0F6c",
@ -644,6 +663,7 @@ Paginator(
view_count: Some(120457),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "9wuyPZjjR9k",
@ -676,6 +696,7 @@ Paginator(
view_count: Some(49062),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "vyJuMGEFbjQ",
@ -708,6 +729,7 @@ Paginator(
view_count: Some(49032),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "_pETMto-9iE",
@ -740,6 +762,7 @@ Paginator(
view_count: Some(64108),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "MvFf9RSJUhk",
@ -772,6 +795,7 @@ Paginator(
view_count: Some(76831),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "E6obq3T71vI",
@ -804,6 +828,7 @@ Paginator(
view_count: Some(49961),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "ZTwVQmUm6NY",
@ -836,6 +861,7 @@ Paginator(
view_count: Some(17393),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "prQinQ4MWmU",
@ -868,6 +894,7 @@ Paginator(
view_count: Some(38281),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "yMIzsFAztv4",
@ -900,6 +927,7 @@ Paginator(
view_count: Some(70004),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "QtqljdMwRyk",
@ -932,6 +960,7 @@ Paginator(
view_count: Some(93700),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "kcWwAweWjQg",
@ -964,6 +993,7 @@ Paginator(
view_count: Some(37515),
is_live: false,
is_short: false,
is_upcoming: false,
),
],
ctoken: Some("4qmFsgKxARIYVUMyRGpGRTdYZjExVVJacVdCaWdjVk9RGmZFZ1oyYVdSbGIzTVlBeUFBTUFFNEFlb0ROME5uVGtSU1JXdFRRM2RwU1cxMGNUaHpTVVJ6TkhCRlFrdEVTWGRCYW1jNFVXZHpTUzFRUkVodFVWbFJhVzloY0VWclowTlZSRWslM0SaAixicm93c2UtZmVlZFVDMkRqRkU3WGYxMVVSWnFXQmlnY1ZPUXZpZGVvczEwMg%3D%3D"),

View file

@ -159,6 +159,7 @@ Channel(
view_count: Some(94),
is_live: true,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "19hKXI1ENrY",
@ -191,6 +192,7 @@ Channel(
view_count: Some(381),
is_live: true,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "CqMUC5eXX7c",
@ -223,6 +225,7 @@ Channel(
view_count: Some(241528),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "A77SYlXKQEM",
@ -255,6 +258,7 @@ Channel(
view_count: Some(118351),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "72vkRHQfjbk",
@ -287,6 +291,7 @@ Channel(
view_count: Some(157971),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "AMWMDhibROw",
@ -319,6 +324,7 @@ Channel(
view_count: Some(82309),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "9UMxZofMNbA",
@ -351,6 +357,7 @@ Channel(
view_count: Some(2043),
is_live: true,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "a2sEYVwBvX4",
@ -383,6 +390,7 @@ Channel(
view_count: Some(186475),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "JAY-prtJnGY",
@ -415,6 +423,7 @@ Channel(
view_count: Some(66425),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "DySa8OrQDi4",
@ -447,6 +456,7 @@ Channel(
view_count: Some(1520020),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "NqzXULaB8MA",
@ -479,6 +489,7 @@ Channel(
view_count: Some(37549),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "UGzy6uhZkmw",
@ -511,6 +522,7 @@ Channel(
view_count: Some(33002),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "iuvapHKpW8A",
@ -543,6 +555,7 @@ Channel(
view_count: Some(42036),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "n_1Nwht-Gh4",
@ -575,6 +588,7 @@ Channel(
view_count: Some(322935),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "6TptI5BtP5U",
@ -607,6 +621,7 @@ Channel(
view_count: Some(91980),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "36YnV9STBqc",
@ -639,6 +654,7 @@ Channel(
view_count: Some(4030),
is_live: true,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "7x6ii2TcsPE",
@ -671,6 +687,7 @@ Channel(
view_count: Some(288098),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "mxV5MBZYYDE",
@ -703,6 +720,7 @@ Channel(
view_count: Some(50818),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "hh2AOoPoAIo",
@ -735,6 +753,7 @@ Channel(
view_count: Some(98431),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "aFlvhtWsJ0g",
@ -767,6 +786,7 @@ Channel(
view_count: Some(572456),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "cD-d7u6fnEI",
@ -799,6 +819,7 @@ Channel(
view_count: Some(3114909),
is_live: false,
is_short: false,
is_upcoming: false,
),
],
ctoken: None,

View file

@ -131,6 +131,7 @@ Channel(
view_count: Some(443549),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "SRrvxFc2b2c",
@ -148,6 +149,7 @@ Channel(
view_count: Some(1154962),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "l9TiwunjzgA",
@ -180,6 +182,7 @@ Channel(
view_count: Some(477460),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "cNx0ql9gnf4",
@ -197,6 +200,7 @@ Channel(
view_count: Some(1388173),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "fGQUWI4o__A",
@ -214,6 +218,7 @@ Channel(
view_count: Some(1738301),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "Q73VTjdqVA8",
@ -231,6 +236,7 @@ Channel(
view_count: Some(1316594),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "pRVSdUxdsVw",
@ -263,6 +269,7 @@ Channel(
view_count: Some(478703),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "gTG2WDbiYGo",
@ -280,6 +287,7 @@ Channel(
view_count: Some(1412213),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "y5JK5YFp92g",
@ -297,6 +305,7 @@ Channel(
view_count: Some(1513305),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "pvSWHm4wlxY",
@ -314,6 +323,7 @@ Channel(
view_count: Some(8936223),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "2FJVhdOO0F0",
@ -346,6 +356,7 @@ Channel(
view_count: Some(987083),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "CqFGACRrWJE",
@ -363,6 +374,7 @@ Channel(
view_count: Some(2769717),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "CutR_1SDDzY",
@ -395,6 +407,7 @@ Channel(
view_count: Some(497660),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "DdGr6t2NqKc",
@ -412,6 +425,7 @@ Channel(
view_count: Some(572107),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "jKS44NMWuXw",
@ -429,6 +443,7 @@ Channel(
view_count: Some(1707132),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "kx1YtJM_vbI",
@ -446,6 +461,7 @@ Channel(
view_count: Some(933094),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "Sdbzs-1WWH0",
@ -463,6 +479,7 @@ Channel(
view_count: Some(5985184),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "9qBHyJIDous",
@ -480,6 +497,7 @@ Channel(
view_count: Some(14741387),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "mBeFDb4gp8s",
@ -497,6 +515,7 @@ Channel(
view_count: Some(2511322),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "b38r1UYqoBQ",
@ -514,6 +533,7 @@ Channel(
view_count: Some(2364408),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "KUz7oArksR4",
@ -546,6 +566,7 @@ Channel(
view_count: Some(706059),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "RdFk4WaifEo",
@ -563,6 +584,7 @@ Channel(
view_count: Some(1947627),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "GuyGyzZcumI",
@ -580,6 +602,7 @@ Channel(
view_count: Some(4763839),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "07Zipsb3-qU",
@ -597,6 +620,7 @@ Channel(
view_count: Some(1915695),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "3kaePnU6Clo",
@ -614,6 +638,7 @@ Channel(
view_count: Some(7268944),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "rt4rXMftnpg",
@ -631,6 +656,7 @@ Channel(
view_count: Some(2539103),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "DTyLUvbf128",
@ -648,6 +674,7 @@ Channel(
view_count: Some(5545680),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "DzjLBgIe_aI",
@ -665,6 +692,7 @@ Channel(
view_count: Some(2202314),
is_live: false,
is_short: true,
is_upcoming: false,
),
ChannelVideo(
id: "sPb2gyN-hnE",
@ -697,6 +725,7 @@ Channel(
view_count: Some(613416),
is_live: false,
is_short: false,
is_upcoming: false,
),
ChannelVideo(
id: "9JboRKeJ2m4",
@ -714,6 +743,7 @@ Channel(
view_count: Some(6443699),
is_live: false,
is_short: true,
is_upcoming: false,
),
],
ctoken: Some("4qmFsgKrARIYVUNoOGdIZHR6TzJ0WGQ1OTNfYmpFcldnGmBFZ1oyYVdSbGIzTVlBeUFBTUFFNEFlb0RNRVZuYzBrM2NsTnVkazF4U1hWemRqQkJVMmQ1VFVGRk5FaHJTVXhEVUhac2NscHJSMFZKWVhWd016RkpRVlpCUVElM0QlM0SaAixicm93c2UtZmVlZFVDaDhnSGR0ek8ydFhkNTkzX2JqRXJXZ3ZpZGVvczEwMg%3D%3D"),

View file

@ -670,12 +670,13 @@ pub struct ChannelVideo {
/// Video publishing date.
///
/// `None` if the date could not be parsed.
/// May be in the future for upcoming videos
pub publish_date: Option<DateTime<Local>>,
/// Textual video publish date (e.g. `11 months ago`, depends on language)
///
/// Is `None` for livestreams.
/// Is `None` for livestreams and upcoming videos.
pub publish_date_txt: Option<String>,
/// View count
/// Number of views / current viewers in case of a livestream.
///
/// `None` if it could not be extracted.
pub view_count: Option<u64>,
@ -683,6 +684,8 @@ pub struct ChannelVideo {
pub is_live: bool,
/// Is the video a YouTube Short video (vertical and <60s)?
pub is_short: bool,
/// Is the video announced, but not released yet (YouTube Premiere)?
pub is_upcoming: bool,
}
/// Playlist fetched from a YouTube channel
@ -741,7 +744,7 @@ pub struct ChannelRssVideo {
pub publish_date: DateTime<Utc>,
/// Date and time when the RSS feed entry was last updated.
pub update_date: DateTime<Utc>,
/// View count
/// Number of views / current viewers in case of a livestream.
pub view_count: u64,
/// Number of likes
///

File diff suppressed because it is too large Load diff