fixes and cleanup
This commit is contained in:
@@ -137,11 +137,7 @@ impl HentaihavenProvider {
|
||||
options: ServerOptions,
|
||||
pool: DbPool,
|
||||
) -> Result<Vec<VideoItem>> {
|
||||
let video_url = format!(
|
||||
"{}/?s={}",
|
||||
self.url,
|
||||
query.replace(" ", "+"),
|
||||
);
|
||||
let video_url = format!("{}/?s={}", self.url, query.replace(" ", "+"),);
|
||||
// Check our Video Cache. If the result is younger than 1 hour, we return it.
|
||||
let old_items = match cache.get(&video_url) {
|
||||
Some((time, items)) => {
|
||||
@@ -171,8 +167,7 @@ impl HentaihavenProvider {
|
||||
return Ok(old_items);
|
||||
}
|
||||
};
|
||||
if page > 1
|
||||
{
|
||||
if page > 1 {
|
||||
return Ok(vec![]);
|
||||
}
|
||||
let video_items: Vec<VideoItem> = self
|
||||
@@ -438,8 +433,7 @@ impl HentaihavenProvider {
|
||||
.last()
|
||||
.and_then(|s| s.split("summary-content\">").nth(1))
|
||||
.and_then(|s| s.split(" Total").nth(0))
|
||||
.map(|s|
|
||||
s.trim().parse::<u32>().unwrap_or(0))
|
||||
.map(|s| s.trim().parse::<u32>().unwrap_or(0))
|
||||
.unwrap_or(0);
|
||||
let mut formats = vec![];
|
||||
let episode_block = html
|
||||
@@ -470,14 +464,23 @@ impl HentaihavenProvider {
|
||||
let format = VideoFormat::new(episode_url, "1080p".to_string(), "m3u8".to_string())
|
||||
.format_id(episode_title.clone())
|
||||
.http_header("Connection".to_string(), "keep-alive".to_string())
|
||||
.http_header("User-Agent".to_string(), "Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0".to_string())
|
||||
.http_header("Accept".to_string(), "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string())
|
||||
.http_header(
|
||||
"User-Agent".to_string(),
|
||||
"Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0"
|
||||
.to_string(),
|
||||
)
|
||||
.http_header(
|
||||
"Accept".to_string(),
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".to_string(),
|
||||
)
|
||||
.http_header("Accept-Language".to_string(), "en-US,en;q=0.5".to_string())
|
||||
.http_header("Accept-Encoding".to_string(), "gzip, deflate, br".to_string())
|
||||
.http_header(
|
||||
"Accept-Encoding".to_string(),
|
||||
"gzip, deflate, br".to_string(),
|
||||
)
|
||||
.http_header("Sec-Fetch-Mode".to_string(), "navigate".to_string())
|
||||
.http_header("Origin".to_string(), self.url.clone())
|
||||
.format_note(episode_title.clone())
|
||||
;
|
||||
.http_header("Origin".to_string(), self.url.clone())
|
||||
.format_note(episode_title.clone());
|
||||
formats.push(format);
|
||||
}
|
||||
if formats.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user