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