improved Error resistance
This commit is contained in:
@@ -288,6 +288,7 @@ impl HqpornerProvider {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter_map(Result::ok)
|
.filter_map(Result::ok)
|
||||||
|
.filter(|item| !item.formats.clone().unwrap().is_empty())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +334,7 @@ impl HqpornerProvider {
|
|||||||
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
let duration = parse_time_to_seconds(&raw_duration).unwrap_or(0) as u32;
|
||||||
|
|
||||||
let (tags, formats) = self.extract_media(&video_url, &mut requester).await?;
|
let (tags, formats) = self.extract_media(&video_url, &mut requester).await?;
|
||||||
|
|
||||||
Ok(
|
Ok(
|
||||||
VideoItem::new(id, title, video_url, "hqporner".into(), thumb, duration)
|
VideoItem::new(id, title, video_url, "hqporner".into(), thumb, duration)
|
||||||
.formats(formats)
|
.formats(formats)
|
||||||
@@ -401,6 +402,10 @@ impl HqpornerProvider {
|
|||||||
.await?
|
.await?
|
||||||
.text()
|
.text()
|
||||||
.await?;
|
.await?;
|
||||||
|
// Check for error response
|
||||||
|
if text2.starts_with("ERR:"){
|
||||||
|
return Ok((tags, formats));
|
||||||
|
}
|
||||||
|
|
||||||
let video_element = text2
|
let video_element = text2
|
||||||
.split("<video ")
|
.split("<video ")
|
||||||
|
|||||||
Reference in New Issue
Block a user