fix: remove dead code
This commit is contained in:
parent
57e13d15a6
commit
fe5468313a
3 changed files with 4 additions and 88 deletions
|
|
@ -54,14 +54,6 @@ pub enum ClientType {
|
|||
Ios,
|
||||
}
|
||||
|
||||
const CLIENT_TYPES: [ClientType; 5] = [
|
||||
ClientType::Desktop,
|
||||
ClientType::DesktopMusic,
|
||||
ClientType::TvHtml5Embed,
|
||||
ClientType::Android,
|
||||
ClientType::Ios,
|
||||
];
|
||||
|
||||
impl ClientType {
|
||||
fn is_web(&self) -> bool {
|
||||
match self {
|
||||
|
|
@ -177,7 +169,6 @@ struct RustyPipeRef {
|
|||
storage: Option<Box<dyn CacheStorage + Sync + Send>>,
|
||||
reporter: Option<Box<dyn Reporter + Sync + Send>>,
|
||||
n_retries: u32,
|
||||
user_agent: String,
|
||||
consent_cookie: String,
|
||||
cache: CacheHolder,
|
||||
default_opts: RustyPipeOpts,
|
||||
|
|
@ -293,7 +284,7 @@ impl RustyPipeBuilder {
|
|||
/// Returns a new, configured RustyPipe instance.
|
||||
pub fn build(self) -> RustyPipe {
|
||||
let http = ClientBuilder::new()
|
||||
.user_agent(self.user_agent.to_owned())
|
||||
.user_agent(self.user_agent)
|
||||
.gzip(true)
|
||||
.brotli(true)
|
||||
.build()
|
||||
|
|
@ -321,7 +312,6 @@ impl RustyPipeBuilder {
|
|||
storage: self.storage,
|
||||
reporter: self.reporter,
|
||||
n_retries: self.n_retries,
|
||||
user_agent: self.user_agent,
|
||||
consent_cookie: format!(
|
||||
"{}={}{}",
|
||||
CONSENT_COOKIE,
|
||||
|
|
|
|||
|
|
@ -193,58 +193,6 @@ fn get_nsig_fn_name(player_js: &str) -> Result<String> {
|
|||
Ok(name.to_owned())
|
||||
}
|
||||
|
||||
fn match_to_closing_parenthesis(string: &str, start: &str) -> Option<String> {
|
||||
let mut start_index = string.find(start)?;
|
||||
start_index += start.len();
|
||||
|
||||
let mut visited_par = false;
|
||||
let mut nesting = 0;
|
||||
let mut last_escaped = false;
|
||||
let mut quote = ' ';
|
||||
let mut res = String::new();
|
||||
|
||||
for c in string[start_index..].chars() {
|
||||
res.push(c);
|
||||
|
||||
let mut this_escaped = false;
|
||||
match c {
|
||||
'{' => {
|
||||
if quote == ' ' {
|
||||
visited_par = true;
|
||||
nesting += 1;
|
||||
}
|
||||
}
|
||||
'}' => {
|
||||
if quote == ' ' {
|
||||
nesting -= 1;
|
||||
}
|
||||
}
|
||||
'\\' => {
|
||||
if !last_escaped {
|
||||
this_escaped = true;
|
||||
}
|
||||
}
|
||||
'\'' | '"' | '`' => {
|
||||
if !last_escaped {
|
||||
if quote == ' ' {
|
||||
quote = c;
|
||||
} else if quote == c {
|
||||
quote = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
if visited_par && nesting == 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
last_escaped = this_escaped;
|
||||
}
|
||||
Some(res)
|
||||
}
|
||||
|
||||
fn extract_js_fn(js: &str, name: &str) -> Result<String> {
|
||||
let scan = ress::Scanner::new(js);
|
||||
let mut state = 0;
|
||||
|
|
@ -416,21 +364,6 @@ c[36](c[8],c[32]),c[20](c[25],c[10]),c[2](c[22],c[8]),c[32](c[20],c[16]),c[32](c
|
|||
assert_eq!(name, "Vo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn t_match_to_closing_parenthesis() {
|
||||
let res =
|
||||
match_to_closing_parenthesis("Kx Hello { Thx { Bye } } Wut {Tst {}}", "Hello").unwrap();
|
||||
assert_eq!(res, " { Thx { Bye } }")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn t_match_to_closing_parenthesis2() {
|
||||
let res =
|
||||
match_to_closing_parenthesis("function(d){return \",}\\\"/\"}abcdef", "function(d)")
|
||||
.unwrap();
|
||||
assert_eq!(res, "{return \",}\\\"/\"}")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn t_extract_js_fn() {
|
||||
let base_js = "Wka = function(d){let x=10/2;return /,,[/,913,/](,)}/}let a = 42;";
|
||||
|
|
|
|||
|
|
@ -37,13 +37,6 @@ impl FilterResult {
|
|||
}
|
||||
|
||||
fn soft(val: bool) -> Self {
|
||||
match val {
|
||||
true => Self::Match,
|
||||
false => Self::Allow,
|
||||
}
|
||||
}
|
||||
|
||||
fn soft_lowest(val: bool) -> Self {
|
||||
match val {
|
||||
true => Self::Match,
|
||||
false => Self::AllowLowest,
|
||||
|
|
@ -77,7 +70,7 @@ impl Filter {
|
|||
|
||||
fn apply_audio_max_bitrate(&self, stream: &AudioStream) -> FilterResult {
|
||||
match self.audio_max_bitrate {
|
||||
Some(max_bitrate) => FilterResult::soft_lowest(stream.average_bitrate <= max_bitrate),
|
||||
Some(max_bitrate) => FilterResult::soft(stream.average_bitrate <= max_bitrate),
|
||||
None => FilterResult::Match,
|
||||
}
|
||||
}
|
||||
|
|
@ -147,7 +140,7 @@ impl Filter {
|
|||
|
||||
fn apply_video_max_res(&self, stream: &VideoStream) -> FilterResult {
|
||||
match self.video_max_res {
|
||||
Some(max_res) => FilterResult::soft_lowest(stream.height.min(stream.width) <= max_res),
|
||||
Some(max_res) => FilterResult::soft(stream.height.min(stream.width) <= max_res),
|
||||
None => FilterResult::Match,
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +156,7 @@ impl Filter {
|
|||
|
||||
fn apply_video_max_fps(&self, stream: &VideoStream) -> FilterResult {
|
||||
match self.video_max_fps {
|
||||
Some(max_fps) => FilterResult::soft_lowest(stream.fps <= max_fps),
|
||||
Some(max_fps) => FilterResult::soft(stream.fps <= max_fps),
|
||||
None => FilterResult::Match,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue