|
1 | 1 | package bilibili
|
2 | 2 |
|
3 |
| -import ( |
4 |
| - "github.com/pkg/errors" |
5 |
| -) |
| 3 | +type GetUserVideosParam struct { |
| 4 | + Mid int `json:"mid"` // 目标用户mid |
| 5 | + Order string `json:"order,omitempty" request:"query,omitempty"` // 排序方式。默认为pubdate。最新发布:pubdate。最多播放:click。最多收藏:stow |
| 6 | + Tid int `json:"tid,omitempty" request:"query,omitempty"` // 筛选目标分区。默认为0。0:不进行分区筛选。分区tid为所筛选的分区 |
| 7 | + Keyword string `json:"keyword,omitempty" request:"query,omitempty"` // 关键词筛选。用于使用关键词搜索该UP主视频稿件 |
| 8 | + Pn int `json:"pn,omitempty" request:"query,omitempty"` // 页码。默认为 1 |
| 9 | + Ps int `json:"ps,omitempty" request:"query,omitempty"` // 每页项数。默认为 30 |
| 10 | +} |
| 11 | + |
| 12 | +type VideoArea struct { |
| 13 | + Count int `json:"count"` // 投稿至该分区的视频数 |
| 14 | + Name string `json:"name"` // 该分区名称 |
| 15 | + Tid int `json:"tid"` // 该分区tid |
| 16 | +} |
| 17 | + |
| 18 | +type UserVideo struct { |
| 19 | + Aid int `json:"aid"` // 稿件avid |
| 20 | + Attribute int `json:"attribute"` |
| 21 | + Author string `json:"author"` // 视频UP主。不一定为目标用户(合作视频) |
| 22 | + Bvid string `json:"bvid"` // 稿件bvid |
| 23 | + Comment int `json:"comment"` // 视频评论数 |
| 24 | + Copyright string `json:"copyright"` // 视频版权类型 |
| 25 | + Created int `json:"created"` // 投稿时间。时间戳 |
| 26 | + Description string `json:"description"` // 视频简介 |
| 27 | + EnableVt int `json:"enable_vt"` |
| 28 | + HideClick bool `json:"hide_click"` // false。作用尚不明确 |
| 29 | + IsPay int `json:"is_pay"` // 0。作用尚不明确 |
| 30 | + IsUnionVideo int `json:"is_union_video"` // 是否为合作视频。0:否。1:是 |
| 31 | + Length string `json:"length"` // 视频长度。MM:SS |
| 32 | + Mid int `json:"mid"` // 视频UP主mid。不一定为目标用户(合作视频) |
| 33 | + Meta any `json:"meta"` // 无数据时为 null |
| 34 | + Pic string `json:"pic"` // 视频封面 |
| 35 | + Play int `json:"play"` // 视频播放次数 |
| 36 | + Review int `json:"review"` // 0。作用尚不明确 |
| 37 | + Subtitle string `json:"subtitle"` // 空。作用尚不明确 |
| 38 | + Title string `json:"title"` // 视频标题 |
| 39 | + Typeid int `json:"typeid"` // 视频分区tid |
| 40 | + VideoReview int `json:"video_review"` // 视频弹幕数 |
| 41 | +} |
| 42 | + |
| 43 | +type UserVideosList struct { |
| 44 | + Tlist map[int]VideoArea `json:"tlist"` // 投稿视频分区索引 |
| 45 | + Vlist []UserVideo `json:"vlist"` // 投稿视频列表 |
| 46 | +} |
| 47 | + |
| 48 | +type UserVideoPage struct { |
| 49 | + Count int `json:"count"` // 总计稿件数 |
| 50 | + Pn int `json:"pn"` // 当前页码 |
| 51 | + Ps int `json:"ps"` // 每页项数 |
| 52 | +} |
| 53 | + |
| 54 | +type EpisodicButton struct { |
| 55 | + Text string `json:"text"` // 按钮文字 |
| 56 | + Uri string `json:"uri"` // 全部播放页url |
| 57 | +} |
| 58 | + |
| 59 | +type UserVideos struct { |
| 60 | + List UserVideosList `json:"list"` // 列表信息 |
| 61 | + Page UserVideoPage `json:"page"` // 页面信息 |
| 62 | + EpisodicButton EpisodicButton `json:"episodic_button"` // “播放全部“按钮 |
| 63 | + IsRisk bool `json:"is_risk"` |
| 64 | + GaiaResType int `json:"gaia_res_type"` |
| 65 | + GaiaData any `json:"gaia_data"` |
| 66 | +} |
6 | 67 |
|
7 | 68 | // GetUserVideos 查询用户投稿视频明细
|
8 |
| -func (c *Client) GetUserVideos() error { |
9 |
| - // https://api.bilibili.com/x/space/wbi/arc/search |
10 |
| - return errors.New("wbi还未实现,本接口暂时无法使用") |
| 69 | +func (c *Client) GetUserVideos(param GetUserVideosParam) (*UserVideos, error) { |
| 70 | + const ( |
| 71 | + method = "GET" |
| 72 | + url = "https://api.bilibili.com/x/space/wbi/arc/search" |
| 73 | + ) |
| 74 | + return execute[*UserVideos](c, method, url, param, fillWbiHandler(c.wbi, c.GetCookies())) |
11 | 75 | }
|
12 | 76 |
|
13 | 77 | type GetUserCardParam struct {
|
|
0 commit comments