Code Monkey home page Code Monkey logo

bilirust's Introduction

bilirust's People

Contributors

niuhuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bilirust's Issues

增加功能:下载收藏夹内容

获取用户收藏夹全部内容,根据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

help

调用出的错误,对象嵌套着数组,🙏🏻

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,
}
返回的json数据:
{
    "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"
        }
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.