Skip to content

archibate/dotfiles-opencode / skills/bilibili-api

bilibili-api

Flagged

This 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.

FileKindSize
SKILL.mdskill md8.3 KB
references/api-modules.mdmarkdown6.4 KB
references/common-patterns.mdmarkdown8.6 KB
references/configuration.mdmarkdown4.8 KB
references/credential-setup.mdmarkdown6.1 KB
references/docs/.gitignoreother13 B
references/docs/.nojekyllother0 B
references/docs/DEPLOY_LOCALHOST.mdmarkdown310 B
references/docs/README.mdmarkdown9.9 KB
references/docs/_sidebar.mdmarkdown4.7 KB
references/docs/b23tv.mdmarkdown448 B
references/docs/configuration.mdmarkdown4.3 KB
references/docs/examples/activity.mdmarkdown960 B
references/docs/examples/app.mdmarkdown127 B
references/docs/examples/article.mdmarkdown918 B
references/docs/examples/article_category.mdmarkdown648 B
references/docs/examples/ass.mdmarkdown727 B
references/docs/examples/audio.mdmarkdown1.8 KB
references/docs/examples/audio_uploader.mdmarkdown975 B
references/docs/examples/bangumi.mdmarkdown3.8 KB
references/docs/examples/black_room.mdmarkdown350 B
references/docs/examples/channel_series.mdmarkdown787 B
references/docs/examples/cheese.mdmarkdown152 B
references/docs/examples/client.mdmarkdown183 B
references/docs/examples/comment.mdmarkdown2.2 KB
references/docs/examples/creative_center.mdmarkdown288 B
references/docs/examples/dynamic.mdmarkdown2.0 KB
references/docs/examples/emoji.mdmarkdown802 B
references/docs/examples/favorite_list.mdmarkdown406 B
references/docs/examples/festival.mdmarkdown3.0 KB
references/docs/examples/game.mdmarkdown1.4 KB
references/docs/examples/garb.mdmarkdown3.2 KB
references/docs/examples/homepage.mdmarkdown127 B
references/docs/examples/hot.mdmarkdown263 B
references/docs/examples/interactive_video.mdmarkdown7.9 KB
references/docs/examples/live.mdmarkdown4.0 KB
references/docs/examples/live_area.mdmarkdown349 B
references/docs/examples/login_v2.mdmarkdown5.1 KB
references/docs/examples/manga.mdmarkdown1.2 KB
references/docs/examples/music.mdmarkdown727 B
references/docs/examples/note.mdmarkdown355 B
references/docs/examples/opus.mdmarkdown1.9 KB
references/docs/examples/rank.mdmarkdown122 B
references/docs/examples/search.mdmarkdown1.3 KB
references/docs/examples/session.mdmarkdown778 B
references/docs/examples/show.mdmarkdown255 B
references/docs/examples/topic.mdmarkdown159 B
references/docs/examples/user.mdmarkdown2.5 KB
references/docs/examples/video.mdmarkdown3.8 KB
references/docs/examples/video_tag.mdmarkdown174 B
references/docs/examples/video_uploader.mdmarkdown2.0 KB
references/docs/examples/video_zone.mdmarkdown279 B
references/docs/examples/vote.mdmarkdown133 B
references/docs/examples/watchroom.mdmarkdown662 B
references/docs/get-credential.mdmarkdown3.2 KB
references/docs/history.htmlother1.5 KB
references/docs/history.mdmarkdown123 B
references/docs/index.htmlother2.2 KB
references/docs/ivifile.mdmarkdown3.9 KB
references/docs/logo-small.pngbinary12.2 KB
references/docs/logo.pngbinary88.6 KB
references/docs/modules/README.mdmarkdown432 B
references/docs/modules/activity.mdmarkdown1.0 KB
references/docs/modules/app.mdmarkdown1.3 KB
references/docs/modules/article.mdmarkdown4.8 KB
references/docs/modules/article_category.mdmarkdown2.1 KB
references/docs/modules/ass.mdmarkdown8.2 KB
references/docs/modules/audio.mdmarkdown3.2 KB
references/docs/modules/audio_uploader.mdmarkdown7.5 KB
references/docs/modules/bangumi.mdmarkdown23.6 KB
references/docs/modules/bilibili_api.mdmarkdown38.4 KB
references/docs/modules/black_room.mdmarkdown6.1 KB
references/docs/modules/channel_series.mdmarkdown4.4 KB
references/docs/modules/cheese.mdmarkdown7.3 KB
references/docs/modules/client.mdmarkdown508 B
references/docs/modules/comment.mdmarkdown7.2 KB
references/docs/modules/creative_center.mdmarkdown14.1 KB
references/docs/modules/dynamic.mdmarkdown13.9 KB
references/docs/modules/emoji.mdmarkdown1.6 KB
references/docs/modules/favorite_list.mdmarkdown10.2 KB
references/docs/modules/festival.mdmarkdown771 B
references/docs/modules/game.mdmarkdown3.1 KB
references/docs/modules/garb.mdmarkdown5.8 KB
references/docs/modules/homepage.mdmarkdown2.2 KB
references/docs/modules/hot.mdmarkdown1.6 KB
references/docs/modules/interactive_video.mdmarkdown13.3 KB
references/docs/modules/live.mdmarkdown20.2 KB
references/docs/modules/live_area.mdmarkdown2.2 KB
references/docs/modules/login_v2.mdmarkdown6.0 KB
references/docs/modules/manga.mdmarkdown4.0 KB
references/docs/modules/music.mdmarkdown3.5 KB
references/docs/modules/note.mdmarkdown4.3 KB
references/docs/modules/opus.mdmarkdown3.3 KB
references/docs/modules/rank.mdmarkdown6.8 KB
references/docs/modules/search.mdmarkdown5.9 KB
references/docs/modules/session.mdmarkdown6.9 KB
references/docs/modules/show.mdmarkdown3.2 KB
references/docs/modules/topic.mdmarkdown2.7 KB
references/docs/modules/user.mdmarkdown25.9 KB
references/docs/modules/video.mdmarkdown28.4 KB
references/docs/modules/video_tag.mdmarkdown1.7 KB
references/docs/modules/video_uploader.mdmarkdown9.9 KB
references/docs/modules/video_zone.mdmarkdown6.8 KB
references/docs/modules/vote.mdmarkdown3.2 KB
references/docs/modules/watchroom.mdmarkdown4.4 KB
references/docs/package-lock.jsonmanifest125.8 KB
references/docs/refresh_cookies.mdmarkdown674 B
references/docs/request_client.mdmarkdown11.1 KB
references/docs/search.jsscript6.4 KB
references/docs/sync-executor.mdmarkdown471 B
references/docs/target/npmlist.jsonconfig268 B
references/docs/theme.cssother15.4 KB
references/docs/vote_id.mdmarkdown2.0 KB
references/docs/vote_source.pngbinary41.8 KB
references/live-guide.mdmarkdown5.1 KB
references/self-update.mdmarkdown5.4 KB
references/upload-guide.mdmarkdown5.9 KB
references/user-guide.mdmarkdown4.7 KB
references/video-guide.mdmarkdown6.0 KB
scripts/credential_check.pyscript3.0 KB
scripts/quickstart.pyscript1.2 KB

references/docs/modules/session.md

View on GitHub
# Module session.py


bilibili_api.session

消息相关


``` python
from bilibili_api import session
```

- [class Event()](#class-Event)
  - [def \_\_init\_\_()](#def-\_\_init\_\_)
- [class EventType()](#class-EventType)
- [class Session()](#class-Session)
  - [def \_\_init\_\_()](#def-\_\_init\_\_)
  - [def close()](#def-close)
  - [def get\_status()](#def-get\_status)
  - [def on()](#def-on)
  - [async def reply()](#async-def-reply)
  - [async def run()](#async-def-run)
  - [async def start()](#async-def-start)
- [async def fetch\_session\_msgs()](#async-def-fetch\_session\_msgs)
- [async def get\_at()](#async-def-get\_at)
- [async def get\_likes()](#async-def-get\_likes)
- [async def get\_replies()](#async-def-get\_replies)
- [async def get\_session\_detail()](#async-def-get\_session\_detail)
- [async def get\_session\_settings()](#async-def-get\_session\_settings)
- [async def get\_sessions()](#async-def-get\_sessions)
- [async def get\_system\_messages()](#async-def-get\_system\_messages)
- [async def get\_unread\_messages()](#async-def-get\_unread\_messages)
- [async def new\_sessions()](#async-def-new\_sessions)
- [async def send\_msg()](#async-def-send\_msg)

---

## class Event()

事件参数:
+ receiver_id:   收信人 UID
+ receiver_type: 收信人类型,1: 私聊, 2: 应援团通知, 3: 应援团
+ sender_uid:发送人 UID
+ talker_id: 对话人 UID
+ msg_seqno: 事件 Seqno
+ msg_type:  事件类型
+ msg_key:   事件唯一编号
+ timestamp: 事件时间戳
+ content:   事件内容




### def \_\_init\_\_()

信息事件类型


| name | type | description |
| - | - | - |
| `data` | `Dict` | 接收到的事件详细信息 |
| `self_uid` | `int` | 用户自身 UID |


---

## class EventType()

**Extend: enum.Enum**

事件类型

- TEXT:   纯文字消息
- PICTURE:图片消息
- WITHDRAW:   撤回消息
- GROUPS_PICTURE: 应援团图片,但似乎不常触发,一般使用 PICTURE 即可
- SHARE_VIDEO:分享视频
- NOTICE: 系统通知
- PUSHED_VIDEO:   UP主推送的视频
- WELCOME:新成员加入应援团欢迎




---

## class Session()

**Extend: bilibili_api.utils.AsyncEvent.AsyncEvent**

会话类,用来开启消息监听。




### def \_\_init\_\_()





### def close()

结束轮询





### def get_status()

获取连接状态



**Returns:** `int`:  0 初始化,1 已连接,2 断开连接中,3 已断开,4 错误




### def on()

重载装饰器注册事件监听器


| name | type | description |
| - | - | - |
| `event_type` | `EventType` | 事件类型 |




### async def reply()

快速回复消息


| name | type | description |
| - | - | - |
| `event` | `Event` | 要回复的消息 |
| `content` | `str \| Picture` | 要回复的文字内容 |

**Returns:** `dict`:  调用接口返回的内容。




### async def run()

非阻塞异步爬虫 定时发送请求获取消息


| name | type | description |
| - | - | - |
| `exclude_self` | `bool` | 是否排除自己发出的消息,默认排除 |




### async def start()

阻塞异步启动 通过调用 self.close() 后可断开连接


| name | type | description |
| - | - | - |
| `exclude_self` | `bool` | 是否排除自己发出的消息,默认排除 |




---

## async def fetch_session_msgs()

获取指定用户的近三十条消息


| name | type | description |
| - | - | - |
| `talker_id` | `int` | 用户 UID |
| `credential` | `Credential` | Credential |
| `session_type` | `int` | 会话类型 1 私聊 2 应援团 |
| `begin_seqno` | `int` | 起始 Seqno |

**Returns:** `dict`:  调用 API 返回结果




---

## async def get_at()

获取收到的 AT


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |
| `last_id` | `Optional, int` | 最后一个 ID. 用于翻页。Defaults to None. |
| `at_time` | `Optional, int` | 最后一个点赞发送时间. 用于翻页。Defaults to None. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def get_likes()

获取收到的赞


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |
| `last_id` | `Optional, int` | 最后一个 ID. 用于翻页。Defaults to None. |
| `like_time` | `Optional, int` | 最后一个点赞发送时间. 用于翻页。Defaults to None. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def get_replies()

获取收到的回复


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |
| `last_reply_id` | `Optional, int` | 最后一个评论的 ID. 用于翻页。Defaults to None. |
| `reply_time` | `Optional, int` | 最后一个评论发送时间. 用于翻页。Defaults to None. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def get_session_detail()

获取会话详情


| name | type | description |
| - | - | - |
| `credential` | `Credential` | Credential |
| `session_type` | `int` | 会话类型 |
| `talker_id` | `int` | 会话对象的UID |

**Returns:** `dict`:  调用 API 返回结果




---

## async def get_session_settings()

获取消息设置


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def get_sessions()

获取已有消息


| name | type | description |
| - | - | - |
| `credential` | `Credential` | Credential |
| `session_type` | `int` | 会话类型 1 |

**Returns:** `dict`:  调用 API 返回结果




---

## async def get_system_messages()

获取系统信息


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def get_unread_messages()

获取未读的信息


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭据类. |

**Returns:** `dict`:  调用 API 返回的结果




---

## async def new_sessions()

获取新消息


| name | type | description |
| - | - | - |
| `credential` | `Credential` | Credential |
| `begin_ts` | `int` | 起始时间戳 |

**Returns:** `dict`:  调用 API 返回结果




---

## async def send_msg()

给用户发送私聊信息。目前仅支持纯文本。

调用 API 需要发送者用户的 UID,可将此携带在凭据类的 DedeUserID 字段,不携带模块将自动获取对应 UID。


| name | type | description |
| - | - | - |
| `credential` | `Credential` | 凭证 |
| `receiver_id` | `int` | 接收者 UID |
| `msg_type` | `EventType` | 信息类型,参考 Event 类的事件类型。 |
| `content` | `str \| Picture` | 信息内容。支持文字和图片。 |

**Returns:** `dict`:  调用 API 返回结果




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: 466kUpdated Claude CodeCodexVerifiedInstall
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: 466kUpdated Claude CodeCodexVerifiedInstall
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: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall