Fix compile issues.

This commit is contained in:
Kavin 2023-09-29 22:29:26 +01:00
parent 59eb2a1db8
commit 57bac7177c
No known key found for this signature in database
GPG key ID: 6E4598CA5C92C41F

View file

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