refactor: 精简代码,统一逻辑 (#229)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-01-24 01:11:59 +08:00
committed by GitHub
parent aa88f97eff
commit 7c220f0d2b
18 changed files with 387 additions and 604 deletions
@@ -43,7 +43,6 @@ impl PartialOrd for AudioQuality {
}
impl AudioQuality {
#[inline]
pub fn as_sort_key(&self) -> isize {
match self {
// 这可以让 Dolby 和 Hi-RES 排在 192k 之后,且 Dolby 和 Hi-RES 之间的顺序不变
@@ -222,7 +222,6 @@ pub fn encoded_query<'a>(
}
}
#[inline]
fn _encoded_query<'a>(
params: Vec<(&'a str, impl Into<Cow<'a, str>>)>,
mixin_key: &str,
-1
View File
@@ -30,7 +30,6 @@ mod watch_later;
static MIXIN_KEY: Lazy<ArcSwapOption<String>> = Lazy::new(Default::default);
#[inline]
pub(crate) fn set_global_mixin_key(key: String) {
MIXIN_KEY.store(Some(Arc::new(key)));
}
+2 -1
View File
@@ -62,7 +62,7 @@ impl<'a> Video<'a> {
Self { client, aid, bvid }
}
/// 直接调用视频信息接口获取详细的视频信息
/// 直接调用视频信息接口获取详细的视频信息,视频信息中包含了视频的分页信息
pub async fn get_view_info(&self) -> Result<VideoInfo> {
let mut res = self
.client
@@ -78,6 +78,7 @@ impl<'a> Video<'a> {
Ok(serde_json::from_value(res["data"].take())?)
}
#[allow(unused)]
pub async fn get_pages(&self) -> Result<Vec<PageInfo>> {
let mut res = self
.client