niuhuan / bilirust Goto Github PK
View Code? Open in Web Editor NEWRUST 哔哩哔哩客户端
License: MIT License
RUST 哔哩哔哩客户端
License: MIT License
获取用户收藏夹全部内容,根据bvid,下载收藏夹内所有视频
api 接口 :https://api.bilibili.com/x/v3/fav/resource/ids
url参数:
参数名 | 类型 | 内容 | 必要性 | 备注 |
---|---|---|---|---|
media_id | num | 目标收藏夹mlid(完整id) | 必要 | |
platform | str | 平台标识 | 非必要 | 可为web(影响内容列表类型) |
json回复:
根对象:
字段 | 类型 | 内容 | 备注 |
---|---|---|---|
code | num | 返回值 | 0:成功 -400:请求错误 -403:访问权限不足 |
message | str | 错误信息 | 默认为0 |
data | 有效时:array 无效或:null |
内容id列表 |
data
中的medias
数组:
项 | 类型 | 内容 | 备注 |
---|---|---|---|
0 | obj | 收藏内容id1 | |
n | obj | 收藏内容id(n+1) | |
... | obj | ... |
medias
数组中的对象:
字段 | 类型 | 内容 | 备注 |
---|---|---|---|
id | num | 内容id | 视频稿件:视频稿件avid 音频:音频auid 视频合集:视频合集id |
type | num | 内容类型 | 2:视频稿件 12:音频 21:视频合集 |
bv_id | str | 视频稿件bvid | |
bvid | str | 视频稿件bvid |
调用出的错误,对象嵌套着数组,🙏🏻
Err` value: data[0]: invalid type: map
添加的代码/src/lib.rs
pub async fn favlist_video(
&self,
media_id: i64,
) -> Result<Favlist> {
Ok(self
.request_api(
reqwest::Method::GET,
"/x/v3/fav/resource/ids",
Some(serde_json::json!({
"media_id":media_id,
})),
None,
)
.await?)
}
/src/entities.rs
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Favlist {
pub medias: Vec<Medias>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Medias{
pub bvid:String,
}
{
"code": 0,
"message": "0",
"ttl": 1,
"data": [
{
"id": 371494037,
"type": 2,
"bv_id": "BV1CZ4y1T7gC",
"bvid": "BV1CZ4y1T7gC"
},
{
"id": 328991940,
"type": 2,
"bv_id": "BV1oA411a72k",
"bvid": "BV1oA411a72k"
},
{
"id": 884042215,
"type": 2,
"bv_id": "BV1fK4y1e7Yj",
"bvid": "BV1fK4y1e7Yj"
},
{
"id": 669013980,
"type": 2,
"bv_id": "BV1Ya4y1E7Y6",
"bvid": "BV1Ya4y1E7Y6"
},
{
"id": 414034824,
"type": 2,
"bv_id": "BV17V411z75A",
"bvid": "BV17V411z75A"
},
{
"id": 541550765,
"type": 2,
"bv_id": "BV1oi4y137sw",
"bvid": "BV1oi4y137sw"
},
{
"id": 626619000,
"type": 2,
"bv_id": "BV1Wt4y1D7Uu",
"bvid": "BV1Wt4y1D7Uu"
},
{
"id": 969124957,
"type": 2,
"bv_id": "BV1Bp4y1q7y9",
"bvid": "BV1Bp4y1q7y9"
},
{
"id": 244079274,
"type": 2,
"bv_id": "BV1Lv411v7G2",
"bvid": "BV1Lv411v7G2"
},
{
"id": 541500006,
"type": 2,
"bv_id": "BV1Xi4y137ER",
"bvid": "BV1Xi4y137ER"
},
{
"id": 796655080,
"type": 2,
"bv_id": "BV1nC4y1879J",
"bvid": "BV1nC4y1879J"
},
{
"id": 839243447,
"type": 2,
"bv_id": "BV1K54y1U77v",
"bvid": "BV1K54y1U77v"
},
{
"id": 329235451,
"type": 2,
"bv_id": "BV13A411e7ad",
"bvid": "BV13A411e7ad"
},
{
"id": 884202228,
"type": 2,
"bv_id": "BV1UK4y1v7K6",
"bvid": "BV1UK4y1v7K6"
},
{
"id": 926710567,
"type": 2,
"bv_id": "BV1BT4y157HK",
"bvid": "BV1BT4y157HK"
},
{
"id": 754200948,
"type": 2,
"bv_id": "BV1qk4y117Uk",
"bvid": "BV1qk4y117Uk"
},
{
"id": 371795957,
"type": 2,
"bv_id": "BV1iZ4y1K7LG",
"bvid": "BV1iZ4y1K7LG"
},
{
"id": 969268280,
"type": 2,
"bv_id": "BV1hp4y1v7mU",
"bvid": "BV1hp4y1v7mU"
},
{
"id": 414281629,
"type": 2,
"bv_id": "BV1xV411U7mm",
"bvid": "BV1xV411U7mm"
},
{
"id": 839319009,
"type": 2,
"bv_id": "BV1t54y1U7hg",
"bvid": "BV1t54y1U7hg"
},
{
"id": 329271769,
"type": 2,
"bv_id": "BV12A411J7JZ",
"bvid": "BV12A411J7JZ"
},
{
"id": 969365400,
"type": 2,
"bv_id": "BV1wp4y1i7U8",
"bvid": "BV1wp4y1i7U8"
},
{
"id": 796831427,
"type": 2,
"bv_id": "BV1yC4y1t7Gb",
"bvid": "BV1yC4y1t7Gb"
},
{
"id": 711972863,
"type": 2,
"bv_id": "BV1YD4y1m7FP",
"bvid": "BV1YD4y1m7FP"
},
{
"id": 754414390,
"type": 2,
"bv_id": "BV1Yk4y127YR",
"bvid": "BV1Yk4y127YR"
},
{
"id": 839478683,
"type": 2,
"bv_id": "BV1i54y127uw",
"bvid": "BV1i54y127uw"
},
{
"id": 499448381,
"type": 2,
"bv_id": "BV19K411N7KE",
"bvid": "BV19K411N7KE"
},
{
"id": 926919797,
"type": 2,
"bv_id": "BV1QT4y1L7Bb",
"bvid": "BV1QT4y1L7Bb"
}
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.