archibate/dotfiles-opencode / skills/bilibili-api
bilibili-api
FlaggedThis skill should be used when the user asks to "use bilibili API", "download bilibili video", "get bilibili user info", "list bilibili favorites", "send bilibili danmaku", "upload video to bilibili", "monitor bilibili live room", "search bilibili", "get bilibili comments", or needs guidance on the bilibili_api Python library usage, authentication, API endpoints, or workflow patterns.
references/docs/examples/comment.md
View on GitHub# 示例:获取视频所有评论
**建议登录后操作**
## 旧接口
```python
from bilibili_api import comment, sync
async def main():
# 存储评论
comments = []
# 页码
page = 1
# 当前已获取数量
count = 0
while True:
# 获取评论
c = await comment.get_comments(418788911, comment.CommentResourceType.VIDEO, page)
replies = c['replies']
if replies is None:
# 未登录时只能获取到前20条评论
# 此时增加页码会导致c为空字典
break
# 存储评论
comments.extend(replies)
# 增加已获取数量
count += c['page']['size']
# 增加页码
page += 1
if count >= c['page']['count']:
# 当前已获取数量已达到评论总数,跳出循环
break
# 打印评论
for cmt in comments:
print(f"{cmt['member']['uname']}: {cmt['content']['message']}")
# 打印评论总数
print(f"\n\n共有 {count} 条评论(不含子评论)")
sync(main())
```
## 新接口
``` python
from bilibili_api import comment, sync
async def main():
# 存储评论
comments = []
# 刷新次数(约等于页码)
page = 1
# 每次提供的 offset (pagination_str)
pag = ""
while True:
# 获取评论
c = await comment.get_comments_lazy(418788911, comment.CommentResourceType.VIDEO, offset=pag)
pag = c["cursor"]["pagination_reply"]["next_offset"]
replies = c['replies']
if replies is None:
# 未登录时只能获取到前20条评论
# 此时增加页码会导致c为空字典
break
# 存储评论
comments.extend(replies)
# 增加页码
page += 1
# 只刷新 5 次(约等于 5 页)
if page > 5:
break
# 打印评论
for cmt in comments:
print(f"{cmt["member"]['uname']}: {cmt['content']['message']}")
# 打印评论总数
print(f"\n\n共有 {len(comments)} 条评论(不含子评论)")
sync(main())
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 466k | Updated | Claude CodeCodex | Verified | Install |
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 466k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |