Skip to content

Commit

Permalink
perf: refactored into mul fn
Browse files Browse the repository at this point in the history
  • Loading branch information
falcon71181 committed Sep 15, 2024
1 parent c964abe commit 82ea773
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ pub struct IntroOutro {
pub end: u32,
}

impl Default for IntroOutro {
fn default() -> Self {
IntroOutro { start: 0, end: 0 }
}
}

#[derive(Debug, Serialize, Deserialize)]
pub struct UnencryptedSrc {
pub file: String,
Expand Down Expand Up @@ -132,8 +138,8 @@ impl MegaCloudServer {
let json_data = fetch_initial_data(&video_id, proxies).await?;

let is_encrypted = json_data["encrypted"].as_bool().unwrap_or(false);
let intro: IntroOutro = parse_json_field(&json_data, "intro")?;
let outro: IntroOutro = parse_json_field(&json_data, "outro")?;
let intro: IntroOutro = parse_json_field(&json_data, "intro").unwrap_or_default();
let outro: IntroOutro = parse_json_field(&json_data, "outro").unwrap_or_default();
let tracks: Vec<Track> = parse_json_field(&json_data, "tracks")?;

let sources = if is_encrypted {
Expand Down

0 comments on commit 82ea773

Please sign in to comment.