mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-05 07:28:04 +08:00
feat: 支持 webui 加载用户的订阅与收藏,一键点击订阅 (#357)
This commit is contained in:
@@ -10,9 +10,10 @@ use serde_json::Value;
|
||||
use crate::bilibili::credential::encoded_query;
|
||||
use crate::bilibili::{BiliClient, MIXIN_KEY, Validate, VideoInfo};
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Debug, Deserialize, Default)]
|
||||
pub enum CollectionType {
|
||||
Series,
|
||||
#[default]
|
||||
Season,
|
||||
}
|
||||
|
||||
|
||||
@@ -33,15 +33,15 @@ impl<'a> Me<'a> {
|
||||
Ok(serde_json::from_value(resp["data"]["list"].take())?)
|
||||
}
|
||||
|
||||
pub async fn get_followed_collections(&self, page: i32) -> Result<Collections> {
|
||||
pub async fn get_followed_collections(&self, page_num: i32, page_size: i32) -> Result<Collections> {
|
||||
let mut resp = self
|
||||
.client
|
||||
.request(Method::GET, "https://api.bilibili.com/x/v3/fav/folder/collected/list")
|
||||
.await
|
||||
.query(&[
|
||||
("up_mid", self.mid.as_ref()),
|
||||
("pn", page.to_string().as_ref()),
|
||||
("ps", "20"),
|
||||
("up_mid", self.mid.as_str()),
|
||||
("pn", page_num.to_string().as_str()),
|
||||
("ps", page_size.to_string().as_str()),
|
||||
("platform", "web"),
|
||||
])
|
||||
.send()
|
||||
@@ -53,15 +53,15 @@ impl<'a> Me<'a> {
|
||||
Ok(serde_json::from_value(resp["data"].take())?)
|
||||
}
|
||||
|
||||
pub async fn get_followed_uppers(&self, page: i32) -> Result<FollowedUppers> {
|
||||
pub async fn get_followed_uppers(&self, page_num: i32, page_size: i32) -> Result<FollowedUppers> {
|
||||
let mut resp = self
|
||||
.client
|
||||
.request(Method::GET, "https://api.bilibili.com/x/relation/followings")
|
||||
.await
|
||||
.query(&[
|
||||
("vmid", self.mid.as_ref()),
|
||||
("pn", page.to_string().as_ref()),
|
||||
("ps", "20"),
|
||||
("vmid", self.mid.as_str()),
|
||||
("pn", page_num.to_string().as_str()),
|
||||
("ps", page_size.to_string().as_str()),
|
||||
])
|
||||
.send()
|
||||
.await?
|
||||
@@ -86,6 +86,7 @@ impl<'a> Me<'a> {
|
||||
pub struct FavoriteItem {
|
||||
pub title: String,
|
||||
pub media_count: i64,
|
||||
pub id: i64,
|
||||
pub fid: i64,
|
||||
pub mid: i64,
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ pub use danmaku::DanmakuOption;
|
||||
pub use error::BiliError;
|
||||
pub use favorite_list::FavoriteList;
|
||||
use favorite_list::Upper;
|
||||
pub use me::Me;
|
||||
use once_cell::sync::Lazy;
|
||||
pub use submission::Submission;
|
||||
pub use video::{Dimension, PageInfo, Video};
|
||||
|
||||
Reference in New Issue
Block a user