updates for everyone
This commit is contained in:
parent
fda5f2bbba
commit
2c7484b538
4 changed files with 1283 additions and 895 deletions
|
|
@ -6,6 +6,7 @@ use std::{
|
|||
use futures::{sink::SinkExt, TryStreamExt};
|
||||
use lazy_static::lazy_static;
|
||||
use log::{info, warn};
|
||||
use pdf::file::{NoCache, NoLog};
|
||||
use reqwest::Url;
|
||||
use scraper::Selector;
|
||||
use time::PrimitiveDateTime;
|
||||
|
|
@ -13,7 +14,7 @@ use tokio_util::codec;
|
|||
|
||||
lazy_static! {
|
||||
static ref CHARTS_URL: Url = Url::parse("https://www.mwra.com/biobot/biobotdata.htm").unwrap();
|
||||
static ref PDF_SEL: Selector = Selector::parse(r#"a[href^="/media/file/mwradata"][href$="-data"]"#).unwrap();
|
||||
static ref PDF_SEL: Selector = Selector::parse(r#"a[href^="/media/file/mwradata"][href$="-datapdf"]"#).unwrap();
|
||||
static ref MIN_CHECK_INTERVAL: Duration = Duration::from_secs(300);
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ impl PdfFetcher {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn fetch(&mut self) -> Result<pdf::file::File<Vec<u8>>, Error> {
|
||||
pub async fn fetch(&mut self) -> Result<pdf::file::File<Vec<u8>, NoCache, NoCache, NoLog>, Error> {
|
||||
info!("Fetching data PDF");
|
||||
|
||||
let cache_modtime = match tokio::fs::File::open(&self.cached_pdf_path).await {
|
||||
|
|
@ -145,7 +146,7 @@ impl PdfFetcher {
|
|||
self.cached_pdf()
|
||||
}
|
||||
|
||||
fn cached_pdf(&self) -> Result<pdf::file::File<Vec<u8>>, Error> {
|
||||
Ok(pdf::file::File::open(&self.cached_pdf_path)?)
|
||||
fn cached_pdf(&self) -> Result<pdf::file::File<Vec<u8>, NoCache, NoCache, NoLog>, Error> {
|
||||
Ok(pdf::file::FileOptions::uncached().open(&self.cached_pdf_path)?)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue