fix: fetch unlocalized player data to interpret errors correctly; regression introduced with v0.6.0
This commit is contained in:
parent
044094a4b7
commit
0919cbd0df
5 changed files with 22 additions and 12 deletions
|
|
@ -16,7 +16,9 @@ use crate::{
|
|||
util::{self, timeago, ProtoBuilder},
|
||||
};
|
||||
|
||||
use super::{response, ClientType, MapRespCtx, MapResponse, QContinuation, RustyPipeQuery};
|
||||
use super::{
|
||||
response, ClientType, MapRespCtx, MapRespOptions, MapResponse, QContinuation, RustyPipeQuery,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
|
@ -178,12 +180,16 @@ impl RustyPipeQuery {
|
|||
continuation: &channel_info_ctoken(channel_id, &random_target()),
|
||||
};
|
||||
|
||||
self.execute_request::<response::ChannelAbout, _, _>(
|
||||
self.execute_request_ctx::<response::ChannelAbout, _, _>(
|
||||
ClientType::Desktop,
|
||||
"channel_info",
|
||||
channel_id,
|
||||
"browse",
|
||||
&request_body,
|
||||
MapRespOptions {
|
||||
unlocalized: true,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1820,7 +1820,7 @@ impl RustyPipeQuery {
|
|||
id: &str,
|
||||
endpoint: &str,
|
||||
body: &B,
|
||||
ctx_src: MapRespCtxSource<'_>,
|
||||
ctx_src: MapRespOptions<'_>,
|
||||
) -> Result<M, Error> {
|
||||
tracing::debug!("getting {}({})", operation, id);
|
||||
|
||||
|
|
@ -1946,7 +1946,7 @@ impl RustyPipeQuery {
|
|||
id,
|
||||
endpoint,
|
||||
body,
|
||||
MapRespCtxSource::default(),
|
||||
MapRespOptions::default(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
|
@ -1989,6 +1989,7 @@ impl AsRef<RustyPipeQuery> for RustyPipeQuery {
|
|||
}
|
||||
}
|
||||
|
||||
/// Additional data needed for mapping YouTube responses
|
||||
struct MapRespCtx<'a> {
|
||||
id: &'a str,
|
||||
lang: Language,
|
||||
|
|
@ -1998,8 +1999,10 @@ struct MapRespCtx<'a> {
|
|||
artist: Option<ArtistId>,
|
||||
}
|
||||
|
||||
/// Options to give to the mapper when making requests;
|
||||
/// used to construct the [`MapRespCtx`]
|
||||
#[derive(Default)]
|
||||
struct MapRespCtxSource<'a> {
|
||||
struct MapRespOptions<'a> {
|
||||
visitor_data: Option<&'a str>,
|
||||
deobf: Option<&'a DeobfData>,
|
||||
artist: Option<ArtistId>,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use regex::Regex;
|
|||
use tracing::debug;
|
||||
|
||||
use crate::{
|
||||
client::{response::url_endpoint::NavigationEndpoint, MapRespCtxSource, QContinuation},
|
||||
client::{response::url_endpoint::NavigationEndpoint, MapRespOptions, QContinuation},
|
||||
error::{Error, ExtractionError},
|
||||
model::{
|
||||
paginator::Paginator, traits::FromYtItem, AlbumItem, ArtistId, MusicArtist, MusicItem,
|
||||
|
|
@ -109,7 +109,7 @@ impl RustyPipeQuery {
|
|||
artist_id,
|
||||
"browse",
|
||||
&request_body,
|
||||
MapRespCtxSource {
|
||||
MapRespOptions {
|
||||
artist: Some(first_page.artist.clone()),
|
||||
visitor_data: first_page.visitor_data.as_deref(),
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::serializer::MapResult;
|
|||
|
||||
use super::response::music_item::{map_queue_item, MusicListMapper, PlaylistPanelVideo};
|
||||
use super::{
|
||||
response, ClientType, MapRespCtx, MapRespCtxSource, MapResponse, QContinuation, RustyPipeQuery,
|
||||
response, ClientType, MapRespCtx, MapRespOptions, MapResponse, QContinuation, RustyPipeQuery,
|
||||
};
|
||||
|
||||
impl RustyPipeQuery {
|
||||
|
|
@ -35,7 +35,7 @@ impl RustyPipeQuery {
|
|||
ctoken,
|
||||
endpoint.as_str(),
|
||||
&request_body,
|
||||
MapRespCtxSource {
|
||||
MapRespOptions {
|
||||
visitor_data,
|
||||
..Default::default()
|
||||
},
|
||||
|
|
@ -55,7 +55,7 @@ impl RustyPipeQuery {
|
|||
ctoken,
|
||||
endpoint.as_str(),
|
||||
&request_body,
|
||||
MapRespCtxSource {
|
||||
MapRespOptions {
|
||||
visitor_data,
|
||||
..Default::default()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use super::{
|
|||
self,
|
||||
player::{self, Format},
|
||||
},
|
||||
ClientType, MapRespCtx, MapRespCtxSource, MapResponse, MapResult, RustyPipeQuery,
|
||||
ClientType, MapRespCtx, MapRespOptions, MapResponse, MapResult, RustyPipeQuery,
|
||||
DEFAULT_PLAYER_CLIENT_ORDER,
|
||||
};
|
||||
|
||||
|
|
@ -159,8 +159,9 @@ impl RustyPipeQuery {
|
|||
video_id,
|
||||
"player",
|
||||
&request_body,
|
||||
MapRespCtxSource {
|
||||
MapRespOptions {
|
||||
deobf: Some(&deobf),
|
||||
unlocalized: true,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Reference in a new issue