fix: A/B test 4, video tab on the trending page
This commit is contained in:
parent
c78b4faacd
commit
d749500a04
7 changed files with 63 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ pub enum ABTest {
|
|||
AttributedTextDescription = 1,
|
||||
ThreeTabChannelLayout = 2,
|
||||
ChannelHandlesInSearchResults = 3,
|
||||
TrendsVideoTab = 4,
|
||||
}
|
||||
|
||||
const TESTS_TO_RUN: [ABTest; 2] = [
|
||||
|
|
@ -38,6 +39,15 @@ struct QVideo<'a> {
|
|||
racy_check_ok: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct QBrowse<'a> {
|
||||
context: YTContext<'a>,
|
||||
browse_id: &'a str,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
params: Option<&'a str>,
|
||||
}
|
||||
|
||||
pub async fn run_test(
|
||||
ab: ABTest,
|
||||
n: usize,
|
||||
|
|
@ -72,6 +82,7 @@ pub async fn run_test(
|
|||
ABTest::ChannelHandlesInSearchResults => {
|
||||
channel_handles_in_search_results(&rp, &visitor_data).await
|
||||
}
|
||||
ABTest::TrendsVideoTab => trends_video_tab(&rp, &visitor_data).await,
|
||||
}
|
||||
.unwrap();
|
||||
pb.inc(1);
|
||||
|
|
@ -170,3 +181,21 @@ pub async fn channel_handles_in_search_results(rp: &RustyPipe, visitor_data: &st
|
|||
_ => false,
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn trends_video_tab(rp: &RustyPipe, visitor_data: &str) -> Result<bool> {
|
||||
let query = rp.query().visitor_data(visitor_data);
|
||||
let context = query.get_context(ClientType::Desktop, true, None).await;
|
||||
let res = query
|
||||
.raw(
|
||||
ClientType::Desktop,
|
||||
"browse",
|
||||
&QBrowse {
|
||||
context,
|
||||
browse_id: "FEtrending",
|
||||
params: None,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(res.contains("\"4gIOGgxtb3N0X3BvcHVsYXI%3D\""))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,14 @@ async fn main() {
|
|||
n,
|
||||
occurrences as f32 / n as f32 * 100.0
|
||||
);
|
||||
eprintln!("visitor_data (present): {vd_present:?}");
|
||||
eprintln!("visitor_data (absent): {vd_absent:?}");
|
||||
eprintln!(
|
||||
"visitor_data (present): {}",
|
||||
vd_present.as_deref().unwrap_or("n/a")
|
||||
);
|
||||
eprintln!(
|
||||
"visitor_data (absent): {}",
|
||||
vd_absent.as_deref().unwrap_or("n/a")
|
||||
);
|
||||
}
|
||||
None => {
|
||||
let res = abtest::run_all_tests(n, cli.concurrency).await;
|
||||
|
|
|
|||
Reference in a new issue