feat!: generate random visitorData, remove RustyPipeQuery::get_context and YTContext<'a> from public API

This commit is contained in:
ThetaDev 2024-10-23 01:51:16 +02:00
parent 9e835c8f38
commit 7c4f44d09c
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
22 changed files with 99 additions and 258 deletions

View file

@ -6,7 +6,7 @@ use indicatif::{ProgressBar, ProgressStyle};
use num_enum::TryFromPrimitive;
use once_cell::sync::Lazy;
use regex::Regex;
use rustypipe::client::{ClientType, RustyPipe, RustyPipeQuery, YTContext};
use rustypipe::client::{ClientType, RustyPipe, RustyPipeQuery};
use rustypipe::model::{MusicItem, YouTubeItem};
use rustypipe::param::search_filter::{ItemType, SearchFilter};
use rustypipe::param::ChannelVideoTab;
@ -57,7 +57,6 @@ pub struct ABTestRes {
#[derive(Debug, Serialize)]
struct QVideo<'a> {
context: YTContext<'a>,
video_id: &'a str,
content_check_ok: bool,
racy_check_ok: bool,
@ -66,7 +65,6 @@ struct QVideo<'a> {
#[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>,
@ -153,9 +151,7 @@ pub async fn run_all_tests(n: usize, concurrency: usize) -> Vec<ABTestRes> {
}
pub async fn attributed_text_description(rp: &RustyPipeQuery) -> Result<bool> {
let context = rp.get_context(ClientType::Desktop, true, None).await;
let q = QVideo {
context,
video_id: "ZeerrnuLi5E",
content_check_ok: false,
racy_check_ok: false,
@ -190,13 +186,11 @@ pub async fn channel_handles_in_search_results(rp: &RustyPipeQuery) -> Result<bo
}
pub async fn trends_video_tab(rp: &RustyPipeQuery) -> Result<bool> {
let context = rp.get_context(ClientType::Desktop, true, None).await;
let res = rp
.raw(
ClientType::Desktop,
"browse",
&QBrowse {
context,
browse_id: "FEtrending",
params: None,
},
@ -207,13 +201,11 @@ pub async fn trends_video_tab(rp: &RustyPipeQuery) -> Result<bool> {
}
pub async fn trends_page_header_renderer(rp: &RustyPipeQuery) -> Result<bool> {
let context = rp.get_context(ClientType::Desktop, true, None).await;
let res = rp
.raw(
ClientType::Desktop,
"browse",
&QBrowse {
context,
browse_id: "FEtrending",
params: None,
},
@ -237,7 +229,6 @@ pub async fn discography_page(rp: &RustyPipeQuery) -> Result<bool> {
ClientType::DesktopMusic,
"browse",
&QBrowse {
context: rp.get_context(ClientType::DesktopMusic, true, None).await,
browse_id: id,
params: None,
},
@ -301,7 +292,6 @@ pub async fn channel_about_modal(rp: &RustyPipeQuery) -> Result<bool> {
ClientType::Desktop,
"browse",
&QBrowse {
context: rp.get_context(ClientType::Desktop, true, None).await,
browse_id: id,
params: None,
},
@ -317,7 +307,6 @@ pub async fn like_button_viewmodel(rp: &RustyPipeQuery) -> Result<bool> {
ClientType::Desktop,
"next",
&QVideo {
context: rp.get_context(ClientType::Desktop, true, None).await,
video_id: "ZeerrnuLi5E",
content_check_ok: true,
racy_check_ok: true,
@ -341,7 +330,6 @@ pub async fn music_playlist_two_column(rp: &RustyPipeQuery) -> Result<bool> {
ClientType::DesktopMusic,
"browse",
&QBrowse {
context: rp.get_context(ClientType::DesktopMusic, true, None).await,
browse_id: id,
params: None,
},
@ -355,14 +343,7 @@ pub async fn comments_framework_update(rp: &RustyPipeQuery) -> Result<bool> {
let continuation =
"Eg0SC3dMZHBSN2d1S3k4GAYyJSIRIgt3TGRwUjdndUt5ODAAeAJCEGNvbW1lbnRzLXNlY3Rpb24%3D";
let res = rp
.raw(
ClientType::Desktop,
"next",
&QCont {
context: rp.get_context(ClientType::Desktop, true, None).await,
continuation,
},
)
.raw(ClientType::Desktop, "next", &QCont { continuation })
.await
.unwrap();
Ok(res.contains("\"frameworkUpdates\""))
@ -375,7 +356,6 @@ pub async fn channel_shorts_lockup(rp: &RustyPipeQuery) -> Result<bool> {
ClientType::Desktop,
"browse",
&QBrowse {
context: rp.get_context(ClientType::Desktop, true, None).await,
browse_id: id,
params: Some("EgZzaG9ydHPyBgUKA5oBAA%3D%3D"),
},
@ -392,7 +372,6 @@ pub async fn playlist_page_header_renderer(rp: &RustyPipeQuery) -> Result<bool>
ClientType::Desktop,
"browse",
&QBrowse {
context: rp.get_context(ClientType::Desktop, true, None).await,
browse_id: id,
params: None,
},

View file

@ -95,11 +95,7 @@ struct HeaderRenderer {
}
async fn get_album_type(query: &RustyPipeQuery, id: &str) -> String {
let context = query
.get_context(ClientType::DesktopMusic, true, None)
.await;
let body = QBrowse {
context,
browse_id: id,
params: None,
};

View file

@ -350,7 +350,6 @@ async fn get_channel(query: &RustyPipeQuery, channel_id: &str) -> Result<Channel
ClientType::Desktop,
"browse",
&QBrowse {
context: query.get_context(ClientType::Desktop, true, None).await,
browse_id: channel_id,
params: Some("EgZ2aWRlb3MYASAAMAE"),
},
@ -392,7 +391,6 @@ async fn get_channel(query: &RustyPipeQuery, channel_id: &str) -> Result<Channel
ClientType::Desktop,
"browse",
&QCont {
context: query.get_context(ClientType::Desktop, true, None).await,
continuation: &popular_token,
},
)
@ -431,9 +429,6 @@ async fn music_channel_subscribers(query: &RustyPipeQuery, channel_id: &str) ->
ClientType::DesktopMusic,
"browse",
&QBrowse {
context: query
.get_context(ClientType::DesktopMusic, true, None)
.await,
browse_id: channel_id,
params: None,
},

View file

@ -270,7 +270,6 @@ async fn get_channel_vlengths(
ClientType::Desktop,
"browse",
&QBrowse {
context: query.get_context(ClientType::Desktop, true, None).await,
browse_id: channel_id,
params: Some("EgZ2aWRlb3MYASAAMAE"),
},

View file

@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use ordered_hash_map::OrderedHashMap;
use rustypipe::{client::YTContext, model::AlbumType, param::Language};
use rustypipe::{model::AlbumType, param::Language};
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DefaultOnError, VecSkipError};
@ -116,7 +116,6 @@ pub enum ExtItemType {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct QBrowse<'a> {
pub context: YTContext<'a>,
pub browse_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
pub params: Option<&'a str>,
@ -125,7 +124,6 @@ pub struct QBrowse<'a> {
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct QCont<'a> {
pub context: YTContext<'a>,
pub continuation: &'a str,
}