refactor: rewrite qbit downlaoder
This commit is contained in:
2
apps/recorder/src/extract/bittorrent/core.rs
Normal file
2
apps/recorder/src/extract/bittorrent/core.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub const BITTORRENT_MIME_TYPE: &str = "application/x-bittorrent";
|
||||
pub const MAGNET_SCHEMA: &str = "magnet";
|
||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
use snafu::{OptionExt, whatever};
|
||||
|
||||
use crate::{
|
||||
errors::{RError, RResult},
|
||||
errors::app_error::{RError, RResult},
|
||||
extract::defs::SUBTITLE_LANG,
|
||||
};
|
||||
|
||||
6
apps/recorder/src/extract/bittorrent/mod.rs
Normal file
6
apps/recorder/src/extract/bittorrent/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
pub mod core;
|
||||
pub mod extract;
|
||||
|
||||
pub use core::{BITTORRENT_MIME_TYPE, MAGNET_SCHEMA};
|
||||
|
||||
pub use extract::*;
|
||||
@@ -6,7 +6,7 @@ use url::Url;
|
||||
|
||||
use super::MikanConfig;
|
||||
use crate::{
|
||||
errors::RError,
|
||||
errors::app_error::RError,
|
||||
fetch::{HttpClient, HttpClientTrait, client::HttpClientCookiesAuth},
|
||||
};
|
||||
|
||||
|
||||
@@ -8,11 +8,13 @@ use tracing::instrument;
|
||||
use url::Url;
|
||||
|
||||
use crate::{
|
||||
downloader::core::BITTORRENT_MIME_TYPE,
|
||||
errors::{RError, RResult},
|
||||
extract::mikan::{
|
||||
MikanClient,
|
||||
web_extract::{MikanEpisodeHomepage, extract_mikan_episode_id_from_homepage},
|
||||
errors::app_error::{RError, RResult},
|
||||
extract::{
|
||||
bittorrent::BITTORRENT_MIME_TYPE,
|
||||
mikan::{
|
||||
MikanClient,
|
||||
web_extract::{MikanEpisodeHomepage, extract_mikan_episode_id_from_homepage},
|
||||
},
|
||||
},
|
||||
fetch::bytes::fetch_bytes,
|
||||
};
|
||||
@@ -338,11 +340,13 @@ mod tests {
|
||||
use url::Url;
|
||||
|
||||
use crate::{
|
||||
downloader::core::BITTORRENT_MIME_TYPE,
|
||||
errors::RResult,
|
||||
extract::mikan::{
|
||||
MikanBangumiAggregationRssChannel, MikanBangumiRssChannel, MikanRssChannel,
|
||||
extract_mikan_rss_channel_from_rss_link,
|
||||
errors::app_error::RResult,
|
||||
extract::{
|
||||
bittorrent::BITTORRENT_MIME_TYPE,
|
||||
mikan::{
|
||||
MikanBangumiAggregationRssChannel, MikanBangumiRssChannel, MikanRssChannel,
|
||||
extract_mikan_rss_channel_from_rss_link,
|
||||
},
|
||||
},
|
||||
test_utils::mikan::build_testing_mikan_client,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
app::AppContextTrait,
|
||||
errors::{RError, RResult},
|
||||
errors::app_error::{RError, RResult},
|
||||
extract::{
|
||||
html::{extract_background_image_src_from_style_attr, extract_inner_text_from_element_ref},
|
||||
media::extract_image_src_from_str,
|
||||
|
||||
@@ -4,4 +4,4 @@ pub mod http;
|
||||
pub mod media;
|
||||
pub mod mikan;
|
||||
pub mod rawname;
|
||||
pub mod torrent;
|
||||
pub mod bittorrent;
|
||||
|
||||
@@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize};
|
||||
use snafu::whatever;
|
||||
|
||||
use crate::{
|
||||
errors::RResult,
|
||||
errors::app_error::RResult,
|
||||
extract::defs::{DIGIT_1PLUS_REG, ZH_NUM_MAP, ZH_NUM_RE},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mod parser;
|
||||
|
||||
pub use parser::*;
|
||||
Reference in New Issue
Block a user