XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/bilibili-API-collect

feat: 获取用户空间图文

close #1249

0ff0b69
SessionHu <102411014+SessionHu@users.noreply.github.com>
提交于

代码差异

3 个文件 +362 -0
Modified README.md +2 -0
@@ -153,6 +153,8 @@ B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接
153 153 - [x] [笔记列表](docs/note/list.md)
154 154 - [x] [笔记详细信息](docs/note/info.md)
155 155 - [x] [笔记操作](docs/note/action.md)
156 - [ ] [图文](docs/opus)
157 - [x] [空间图文](docs/opus/space.md)
156 158 - [ ] [专栏](docs/article)
157 159 - [ ] [专栏内容](docs/article/view.md)
158 160 - [ ] [专栏分类](docs/article/category.md)
Modified docs/dynamic/space.md +4 -0
@@ -6,6 +6,10 @@
6 6
7 7 认证方式:Cookie(SESSDATA)
8 8
9 鉴权方式: WBI 签名
10
11 注: 该接口现在有一些奇奇怪怪的校验, 参见 [#686](https://github.com/SocialSisterYi/bilibili-API-collect/issues/686)
12
9 13 ## URL参数
10 14
11 15 | 参数名 | 类型 | 必填 | 内容 | 备注 |
Added docs/opus/space.md +356 -0
@@ -0,0 +1,356 @@
1 ## 空间图文
2
3 ## 获取用户空间图文
4
5 > https://api.bilibili.com/x/polymer/web-dynamic/v1/opus/feed/space
6
7 *请求方法: GET*
8
9 注: 该接口**只能**获取图文信息, 无法获取如转发动态一类的内容, 如需获取参见 [获取用户空间动态](docs/dynamic/space.md)
10
11 **URL 参数:**
12
13 | 参数名 | 类型 | 内容 | 必要性 | 备注 |
14 | -------- | ------ | ---- | ------ | ---- |
15 | host_mid | number | 被获取用户的 mid (UID) | 必要 | |
16 | page | number | 假装自己是分页信息 | 不必要 | 以 `1` 开始 |
17 | offset | number | 偏移信息 | 不必要 | 上一次返回的 `offset` (同时也是最后一条的 opus id), 默认为空 |
18 | type | string | 类型 | 不必要 | all: 全部 (默认)<br />article: 专栏<br />dynamic: 动态 |
19 | web_location | string | `333.1387` | 不必要 | |
20 | w_rid | string | WBI 签名 | 不必要 | 参见 [WBI 签名](../miac/sign/wbi.md) |
21 | wts | number | UNIX 秒级时间戳 | 不必要 | 参见 [WBI 签名](../miac/sign/wbi.md) |
22
23 **JSON 回复:**
24
25 根对象:
26
27 | 字段 | 类型 | 内容 | 备注 |
28 | ---- | ---- | ---- | ---- |
29 | code | number | 返回值 | 0: 成功 |
30 | data | object | 数据本体 | |
31 | message | string | 错误信息 | 成功时为 `0` |
32 | ttl | number | `1` | |
33
34 `data` 对象:
35
36 | 字段 | 类型 | 内容 | 备注 |
37 | ---- | ---- | ---- | ---- |
38 | has_more | boolean | 是否还有更多 | |
39 | items | object[] | 信息本体 | |
40 | offset | string | 偏移信息 | 下次翻页请求时传入的 `offest` (同时也是最后一条的 opus id) |
41 | update_num | number | 更新数? | 0 |
42
43 `data.items[]` 对象:
44
45 | 字段 | 类型 | 内容 | 备注 |
46 | ---- | ---- | ---- | ---- |
47 | content | string | 文本内容 | |
48 | cover | object? | 封面信息 | |
49 | jump_url | string | 跳转 URL | |
50 | opus_id | string | opus id | |
51 | stat | object | 统计信息 | |
52
53 `data.items[].cover` 对象:
54
55 | 字段 | 类型 | 内容 | 备注 |
56 | ---- | ---- | ---- | ---- |
57 | height | number | 高度 | |
58 | url | string | 图片 URL | |
59 | width | number | 宽度 | |
60
61 `data.items[].stat` 对象:
62
63 | 字段 | 类型 | 内容 | 备注 |
64 | ---- | ---- | ---- | ---- |
65 | like | string | 点赞数 | 是个字符串 |
66 | view | string | 浏览数 | 仅当获取登录状态下获取自己的时才存在, 也是个字符串 |
67
68 **示例:**
69
70 获取 `645769214` 空间的最近几条全部图文
71
72 ```shell
73 curl 'https://api.bilibili.com/x/polymer/web-dynamic/v1/opus/feed/space' \
74 --url-query 'host_mid=645769214'
75 ```
76
77 <details>
78 <summary>查看响应示例:</summary>
79
80 ```json
81 {
82 "code": 0,
83 "data": {
84 "has_more": true,
85 "items": [
86 {
87 "content": "我在 Google I/O 2025 的 puzzle 取得了获胜的优异成绩, 你也来试试吧",
88 "cover": {
89 "height": 1640,
90 "url": "http://i0.hdslb.com/bfs/new_dyn/a48c47c07bf19f07c01b489eb6b42e63645769214.jpg",
91 "width": 720
92 },
93 "jump_url": "//www.bilibili.com/opus/1057955152016703512",
94 "opus_id": "1057955152016703512",
95 "stat": {
96 "like": "1"
97 }
98 },
99 {
100 "content": "通过 DevTools 绕过 SSR 抓包某站专栏正文接口",
101 "cover": {
102 "height": 430,
103 "url": "http://i0.hdslb.com/bfs/article/9071997152b6fec0ae465fe2a86b580e645769214.jpg",
104 "width": 768
105 },
106 "jump_url": "//www.bilibili.com/opus/1056353752004427792",
107 "opus_id": "1056353752004427792",
108 "stat": {
109 "like": "3"
110 }
111 },
112 {
113 "content": "今天也是看上 Minecraft 大电影 了, 看的人几乎没有, 虽然看的是中配, 总体上感觉剧情有趣甚至有点小感动, 音乐也感觉不错, 价格也实惠",
114 "cover": {
115 "height": 4080,
116 "url": "http://i0.hdslb.com/bfs/new_dyn/408d4e2b2ad8df6873c303cf26f571db645769214.jpg",
117 "width": 3060
118 },
119 "jump_url": "//www.bilibili.com/opus/1052711525276450824",
120 "opus_id": "1052711525276450824",
121 "stat": {
122 "like": "3"
123 }
124 },
125 {
126 "content": "糟了没注意, 自己成小丑了",
127 "cover": {
128 "height": 1640,
129 "url": "http://i0.hdslb.com/bfs/new_dyn/6ebb3894cfab53966d6e440e4f5a905d645769214.jpg",
130 "width": 720
131 },
132 "jump_url": "//www.bilibili.com/opus/1051313732437671938",
133 "opus_id": "1051313732437671938",
134 "stat": {
135 "like": "3"
136 }
137 },
138 {
139 "content": "好消息, 我免费了, 想玩的随时联系\nhttps://t.me/c/2148747379/77",
140 "cover": {
141 "height": 720,
142 "url": "http://i0.hdslb.com/bfs/new_dyn/fbc2b38406099df0bdaea47d08daa6f1645769214.jpg",
143 "width": 1640
144 },
145 "jump_url": "//www.bilibili.com/opus/1050579658107518984",
146 "opus_id": "1050579658107518984",
147 "stat": {
148 "like": "2"
149 }
150 },
151 {
152 "content": "认真的, 我的 Linux 发行版是 Android",
153 "cover": {
154 "height": 1080,
155 "url": "http://i0.hdslb.com/bfs/new_dyn/3e512d84361323c319f79061d2f078d1645769214.jpg",
156 "width": 1440
157 },
158 "jump_url": "//www.bilibili.com/opus/1032607998809210903",
159 "opus_id": "1032607998809210903",
160 "stat": {
161 "like": "8"
162 }
163 },
164 {
165 "content": "于学校机房启动 QEMU 珍贵影像",
166 "cover": {
167 "height": 1080,
168 "url": "http://i0.hdslb.com/bfs/new_dyn/2fdc7524449b029f8baf241d94663256645769214.jpg",
169 "width": 1440
170 },
171 "jump_url": "//www.bilibili.com/opus/993403941079220225",
172 "opus_id": "993403941079220225",
173 "stat": {
174 "like": "3"
175 }
176 },
177 {
178 "content": "BAC 正处于历史以来最困难的时期 - 中秋考古有感",
179 "cover": {
180 "height": 188,
181 "url": "https://i0.hdslb.com/bfs/article/0c9b5e20356e07f89a8bb7769fef8eeb645769214.jpg",
182 "width": 640
183 },
184 "jump_url": "//www.bilibili.com/opus/985444108243828741",
185 "opus_id": "985444108243828741",
186 "stat": {
187 "like": "7"
188 }
189 },
190 {
191 "content": "发送文件到手机的 N 种正确姿势",
192 "cover": {
193 "height": 420,
194 "url": "http://i0.hdslb.com/bfs/article/56a4024abebf7ed1166a1d247bb5cf64645769214.jpg",
195 "width": 750
196 },
197 "jump_url": "//www.bilibili.com/opus/971804623539011587",
198 "opus_id": "971804623539011587",
199 "stat": {
200 "like": "8"
201 }
202 },
203 {
204 "content": "我在朝鲜?",
205 "cover": {
206 "height": 468,
207 "url": "http://i0.hdslb.com/bfs/new_dyn/ea12cca6abd75fe3fb5ad1abd1f347d3645769214.png",
208 "width": 474
209 },
210 "jump_url": "//www.bilibili.com/opus/971255284349534210",
211 "opus_id": "971255284349534210",
212 "stat": {
213 "like": "5"
214 }
215 },
216 {
217 "content": "一周没上 B 站就 99+ 了?",
218 "cover": {
219 "height": 284,
220 "url": "http://i0.hdslb.com/bfs/new_dyn/9e3b889fd2dc75e9bae38a13e55fee26645769214.png",
221 "width": 165
222 },
223 "jump_url": "//www.bilibili.com/opus/970197833343827970",
224 "opus_id": "970197833343827970",
225 "stat": {
226 "like": "6"
227 }
228 },
229 {
230 "content": "今天因为Linux被骂, 决定放弃支持 Windows. 而且明天要开始军训了, 将停更若干时间, 遂发此动态, 望不知.",
231 "cover": {
232 "height": 1080,
233 "url": "http://i0.hdslb.com/bfs/new_dyn/0f6f939334104ddc347566514fa4bfa7645769214.jpg",
234 "width": 1440
235 },
236 "jump_url": "//www.bilibili.com/opus/967717348014293017",
237 "opus_id": "967717348014293017",
238 "stat": {
239 "like": "73"
240 }
241 },
242 {
243 "content": "我的萌ICP备案通过了!",
244 "cover": {
245 "height": 2712,
246 "url": "http://i0.hdslb.com/bfs/new_dyn/0a9bb3e82bbefe499b10b7fd02f2a4f4645769214.jpg",
247 "width": 1220
248 },
249 "jump_url": "//www.bilibili.com/opus/956241611959828547",
250 "opus_id": "956241611959828547",
251 "stat": {
252 "like": "1"
253 }
254 },
255 {
256 "content": "新年第一个AP",
257 "cover": {
258 "height": 1220,
259 "url": "https://album.biliimg.com/bfs/new_dyn/ea5a39d37a4a1f20f32b25bfed466004645769214.jpg",
260 "width": 2712
261 },
262 "jump_url": "//www.bilibili.com/opus/896448108088524805",
263 "opus_id": "896448108088524805",
264 "stat": {
265 "like": "1"
266 }
267 },
268 {
269 "content": "新年快乐?",
270 "cover": {
271 "height": 605,
272 "url": "https://album.biliimg.com/bfs/new_dyn/dab5d3e2ff03027215e5bfd4933abe45645769214.jpg",
273 "width": 1220
274 },
275 "jump_url": "//www.bilibili.com/opus/896342627995090966",
276 "opus_id": "896342627995090966",
277 "stat": {
278 "like": "1"
279 }
280 },
281 {
282 "content": "我回苏州了",
283 "cover": {
284 "height": 1280,
285 "url": "https://album.biliimg.com/bfs/new_dyn/65c880f64997fab0c79527649d7fbe1b645769214.png",
286 "width": 720
287 },
288 "jump_url": "//www.bilibili.com/opus/831507996405137432",
289 "opus_id": "831507996405137432",
290 "stat": {
291 "like": "1"
292 }
293 },
294 {
295 "content": "Phigros RKS 12 纪念",
296 "cover": {
297 "height": 720,
298 "url": "https://album.biliimg.com/bfs/new_dyn/dab03003aee2166987428857acbf4ffb645769214.png",
299 "width": 1280
300 },
301 "jump_url": "//www.bilibili.com/opus/830690195959447605",
302 "opus_id": "830690195959447605",
303 "stat": {
304 "like": "0"
305 }
306 },
307 {
308 "content": "现在知道B站推荐机制有多烂了吧",
309 "cover": {
310 "height": 1280,
311 "url": "https://album.biliimg.com/bfs/new_dyn/05a5f769bed2705d2c8c3c69f60441df645769214.png",
312 "width": 720
313 },
314 "jump_url": "//www.bilibili.com/opus/829284474633060387",
315 "opus_id": "829284474633060387",
316 "stat": {
317 "like": "0"
318 }
319 },
320 {
321 "content": "求证: B站创始人们的成分\n证: [图片]",
322 "cover": {
323 "height": 1600,
324 "url": "https://album.biliimg.com/bfs/new_dyn/830a9bbc3d5179a6d33af97e5baac7c8645769214.jpg",
325 "width": 720
326 },
327 "jump_url": "//www.bilibili.com/opus/828071498582327315",
328 "opus_id": "828071498582327315",
329 "stat": {
330 "like": "1"
331 }
332 },
333 {
334 "content": "如果排除掉可能的误差, 14=12.",
335 "cover": {
336 "height": 720,
337 "url": "https://album.biliimg.com/bfs/new_dyn/79823dd0b617af6fc71126d6e042de3f645769214.png",
338 "width": 1280
339 },
340 "jump_url": "//www.bilibili.com/opus/827727935543705620",
341 "opus_id": "827727935543705620",
342 "stat": {
343 "like": "1"
344 }
345 }
346 ],
347 "offset": "827727935543705620",
348 "update_num": 0
349 },
350 "message": "0",
351 "ttl": 1
352 }
353 ```
354 </details>
355
356 <!-- Generated by json-apidoc-gen @ 2025-05-01T00:59:41.402217612Z -->