fix: parsing video details for DRM-restricted movies
This commit is contained in:
parent
b752b6ea9b
commit
43ed52daf9
12 changed files with 15 additions and 13 deletions
|
|
@ -77,8 +77,8 @@ pub(crate) enum VideoResultsItem {
|
|||
/// Like/Dislike button
|
||||
video_actions: VideoActions,
|
||||
/// Absolute textual date (e.g. `Dec 29, 2019`)
|
||||
#[serde_as(as = "Text")]
|
||||
date_text: String,
|
||||
#[serde_as(as = "Option<Text>")]
|
||||
date_text: Option<String>,
|
||||
},
|
||||
#[serde(rename_all = "camelCase")]
|
||||
VideoSecondaryInfoRenderer {
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ VideoDetails(
|
|||
view_count: 233243423,
|
||||
like_count: Some(4015532),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Nov 17, 2020",
|
||||
publish_date_txt: Some("Nov 17, 2020"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ VideoDetails(
|
|||
view_count: 234258725,
|
||||
like_count: Some(4027586),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Nov 17, 2020",
|
||||
publish_date_txt: Some("Nov 17, 2020"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ VideoDetails(
|
|||
view_count: 1251797,
|
||||
like_count: Some(58077),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Sep 15, 2022",
|
||||
publish_date_txt: Some("Sep 15, 2022"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ VideoDetails(
|
|||
view_count: 205,
|
||||
like_count: None,
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Jan 2, 2019",
|
||||
publish_date_txt: Some("Jan 2, 2019"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ VideoDetails(
|
|||
view_count: 2493983,
|
||||
like_count: Some(52274),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Dec 29, 2019",
|
||||
publish_date_txt: Some("Dec 29, 2019"),
|
||||
is_live: false,
|
||||
is_ccommons: true,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ VideoDetails(
|
|||
view_count: 971966,
|
||||
like_count: Some(48244),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Sep 15, 2022",
|
||||
publish_date_txt: Some("Sep 15, 2022"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ VideoDetails(
|
|||
view_count: 681,
|
||||
like_count: Some(872230),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Started streaming on Sep 23, 2021",
|
||||
publish_date_txt: Some("Started streaming on Sep 23, 2021"),
|
||||
is_live: true,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ VideoDetails(
|
|||
view_count: 20304,
|
||||
like_count: Some(146),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Aug 6, 2020",
|
||||
publish_date_txt: Some("Aug 6, 2020"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ VideoDetails(
|
|||
view_count: 232792465,
|
||||
like_count: Some(4010156),
|
||||
publish_date: "[date]",
|
||||
publish_date_txt: "Nov 17, 2020",
|
||||
publish_date_txt: Some("Nov 17, 2020"),
|
||||
is_live: false,
|
||||
is_ccommons: false,
|
||||
chapters: [],
|
||||
|
|
|
|||
|
|
@ -175,7 +175,9 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
|||
// accessibility_data contains no digits if the like count is hidden,
|
||||
// so we ignore parse errors here for now
|
||||
like_btn.and_then(|btn| util::parse_numeric(&btn.accessibility_data).ok()),
|
||||
timeago::parse_textual_date_or_warn(lang, &date_text, &mut warnings),
|
||||
date_text.as_deref().and_then(|txt| {
|
||||
timeago::parse_textual_date_or_warn(lang, txt, &mut warnings)
|
||||
}),
|
||||
date_text,
|
||||
view_count
|
||||
.map(|vc| vc.video_view_count_renderer.is_live)
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ pub struct VideoDetails {
|
|||
#[serde(with = "time::serde::rfc3339::option")]
|
||||
pub publish_date: Option<OffsetDateTime>,
|
||||
/// Textual video publishing date (e.g. `Aug 2, 2013`, depends on language)
|
||||
pub publish_date_txt: String,
|
||||
pub publish_date_txt: Option<String>,
|
||||
/// Is the video a livestream?
|
||||
pub is_live: bool,
|
||||
/// Is the video published under the Creative Commons BY 3.0 license?
|
||||
|
|
|
|||
Reference in a new issue