fix: video_details empty content, update client versions
This commit is contained in:
parent
0d1e569248
commit
d4d029c3ce
3 changed files with 9 additions and 8 deletions
|
|
@ -141,13 +141,13 @@ const YOUTUBE_MUSIC_V1_URL: &str = "https://music.youtube.com/youtubei/v1/";
|
||||||
|
|
||||||
const DISABLE_PRETTY_PRINT_PARAMETER: &str = "&prettyPrint=false";
|
const DISABLE_PRETTY_PRINT_PARAMETER: &str = "&prettyPrint=false";
|
||||||
|
|
||||||
const DESKTOP_CLIENT_VERSION: &str = "2.20220909.00.00";
|
const DESKTOP_CLIENT_VERSION: &str = "2.20221011.00.00";
|
||||||
const DESKTOP_API_KEY: &str = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";
|
const DESKTOP_API_KEY: &str = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8";
|
||||||
const TVHTML5_CLIENT_VERSION: &str = "2.0";
|
const TVHTML5_CLIENT_VERSION: &str = "2.0";
|
||||||
const DESKTOP_MUSIC_API_KEY: &str = "AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30";
|
const DESKTOP_MUSIC_API_KEY: &str = "AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30";
|
||||||
const DESKTOP_MUSIC_CLIENT_VERSION: &str = "1.20220831.01.02";
|
const DESKTOP_MUSIC_CLIENT_VERSION: &str = "1.20221005.01.00";
|
||||||
|
|
||||||
const MOBILE_CLIENT_VERSION: &str = "17.29.35";
|
const MOBILE_CLIENT_VERSION: &str = "17.39.35";
|
||||||
const ANDROID_API_KEY: &str = "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w";
|
const ANDROID_API_KEY: &str = "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w";
|
||||||
const IOS_API_KEY: &str = "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc";
|
const IOS_API_KEY: &str = "AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc";
|
||||||
const IOS_DEVICE_MODEL: &str = "iPhone14,5";
|
const IOS_DEVICE_MODEL: &str = "iPhone14,5";
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use super::{
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct VideoDetails {
|
pub struct VideoDetails {
|
||||||
/// Video metadata + recommended videos
|
/// Video metadata + recommended videos
|
||||||
pub contents: Contents,
|
pub contents: Option<Contents>,
|
||||||
/// Video ID
|
/// Video ID
|
||||||
pub current_video_endpoint: Option<CurrentVideoEndpoint>,
|
pub current_video_endpoint: Option<CurrentVideoEndpoint>,
|
||||||
/// Video chapters + comment section
|
/// Video chapters + comment section
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,9 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
||||||
) -> Result<MapResult<VideoDetails>, ExtractionError> {
|
) -> Result<MapResult<VideoDetails>, ExtractionError> {
|
||||||
let mut warnings = Vec::new();
|
let mut warnings = Vec::new();
|
||||||
|
|
||||||
|
let contents = self
|
||||||
|
.contents
|
||||||
|
.ok_or_else(|| ExtractionError::ContentUnavailable("Video not found".into()))?;
|
||||||
let current_video_endpoint = self
|
let current_video_endpoint = self
|
||||||
.current_video_endpoint
|
.current_video_endpoint
|
||||||
.ok_or_else(|| ExtractionError::ContentUnavailable("Video not found".into()))?;
|
.ok_or_else(|| ExtractionError::ContentUnavailable("Video not found".into()))?;
|
||||||
|
|
@ -104,8 +107,7 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut primary_results = self
|
let mut primary_results = contents
|
||||||
.contents
|
|
||||||
.two_column_watch_next_results
|
.two_column_watch_next_results
|
||||||
.results
|
.results
|
||||||
.results
|
.results
|
||||||
|
|
@ -247,8 +249,7 @@ impl MapResponse<VideoDetails> for response::VideoDetails {
|
||||||
_ => return Err(ExtractionError::InvalidData("invalid channel link".into())),
|
_ => return Err(ExtractionError::InvalidData("invalid channel link".into())),
|
||||||
};
|
};
|
||||||
|
|
||||||
let recommended = self
|
let recommended = contents
|
||||||
.contents
|
|
||||||
.two_column_watch_next_results
|
.two_column_watch_next_results
|
||||||
.secondary_results
|
.secondary_results
|
||||||
.and_then(|sr| {
|
.and_then(|sr| {
|
||||||
|
|
|
||||||
Reference in a new issue