diff --git a/src/main.rs b/src/main.rs index 32e5922..6244784 100644 --- a/src/main.rs +++ b/src/main.rs @@ -322,8 +322,7 @@ async fn index(req: HttpRequest) -> Result> { } if content_type == "video/vnd.mpeg.dash.mpd" || content_type == "application/dash+xml" { let mut resp_str = resp.text().await.unwrap(); - let clone_resp = resp_str.clone(); - let captures = RE_DASH_MANIFEST.captures_iter(&clone_resp); + let captures = RE_DASH_MANIFEST.captures_iter(&resp_str); for capture in captures { let url = capture.get(1).unwrap().as_str(); let new_url = localize_url(url, host.as_str()); @@ -352,11 +351,7 @@ fn localize_url(url: &str, host: &str) -> String { return format!("{}?{}", url.path(), url.query().unwrap()); } else if url.ends_with(".m3u8") || url.ends_with(".ts") { - return if url.contains('?') { - format!("{}&host={}", url, host) - } else { - format!("{}?host={}", url, host) - }; + format!("{}{}host={}", url, if url.contains('?') { "&" } else { "?" }, host) } url.to_string()