bilibili-cli

CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interactions from the terminal

631 stars

Best use case

bilibili-cli is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interactions from the terminal

Teams using bilibili-cli should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

How bilibili-cli Compares

Feature / Agentbilibili-cliStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interactions from the terminal

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# bilibili-cli Skill

A CLI tool for interacting with Bilibili (哔哩哔哩). Use it to fetch video info, search content, browse user profiles, and perform interactions like liking or triple-clicking.

## Agent Defaults

When you need machine-readable output:

1. Prefer `--yaml` first because it is usually more token-efficient than pretty JSON.
2. Use `--json` only when downstream tooling strictly requires JSON.
3. Keep result sets small with `--max`, `--page`, or `--offset`.
4. Prefer specific commands over broad ones. Example: use `bili user-videos 946974 --max 3 --yaml` instead of fetching large timelines.
5. When summarizing a video, fetch subtitles first. Subtitles usually contain the video's core content and are the best primary source for summaries.
6. Only fall back to `--ai`, comments, or audio extraction when subtitles are unavailable or clearly insufficient.

## Prerequisites

```bash
# Install (requires Python 3.10+)
uv tool install bilibili-cli
# Or: pipx install bilibili-cli

# If you need audio extraction support (requires PyAV)
uv tool install "bilibili-cli[audio]"
# Or: pipx install "bilibili-cli[audio]"

# Upgrade to latest (recommended to avoid API errors)
uv tool upgrade bilibili-cli
# Or: pipx upgrade bilibili-cli
```

## Authentication

Most read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.

```bash
bili status                    # Check if logged in (exit 0 = yes, 1 = no)
bili login                     # QR code login (if not authenticated)
```

Authentication auto-detects local browser cookies (Chrome/Firefox/Edge/Brave). If cookies are found and valid, no manual login needed. Credentials are saved to `~/.bilibili-cli/credential.json`.

## Command Reference

### Video

```bash
# Get video details (accepts BV ID or full URL)
bili video BV1ABcsztEcY
bili video https://www.bilibili.com/video/BV1ABcsztEcY

# Options
bili video BV1ABcsztEcY --subtitle            # Show subtitles (plain text)
bili video BV1ABcsztEcY --subtitle-timeline   # Show subtitles with timestamps
bili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT format
bili video BV1ABcsztEcY --ai            # Show B站 AI summary
bili video BV1ABcsztEcY --comments      # Show top comments
bili video BV1ABcsztEcY --related       # Show related videos
bili video BV1ABcsztEcY --yaml          # Token-efficient YAML output
bili video BV1ABcsztEcY --json          # Structured JSON envelope
```

### User

```bash
# Look up user profile (by UID or username)
bili user 946974
bili user "影视飓风"

# List user's videos
bili user-videos 946974 --max 20
bili user-videos "影视飓风" --yaml
```

### Search

```bash
# Search users (default)
bili search "关键词"

# Search videos
bili search "关键词" --type video

# Pagination and limit
bili search "关键词" --type video --max 5
bili search "关键词" --page 2
```

### Discovery

```bash
bili hot                       # Trending/popular videos
bili hot --page 2 --max 10     # Page 2, limit 10
bili rank                      # Site-wide ranking (3-day)
bili rank --day 7 --max 30     # 7-day ranking, top 30
bili feed                      # Dynamic timeline (requires login)
bili feed --offset 1234567890  # Next page via returned cursor
bili my-dynamics               # My posted dynamics (requires login)
bili dynamic-post "hello"      # Publish text dynamic (requires write credential)
bili dynamic-delete 123456789  # Delete one dynamic (requires write credential)
```

### Collections (require login)

```bash
bili favorites                 # List favorite folders
bili favorites <ID> --page 2   # Videos in a folder
bili following                 # Following list
bili watch-later               # Watch later list
bili history                   # Watch history
```

### Audio Extraction

Requires `bilibili-cli[audio]` extra (PyAV). Install with `uv tool install "bilibili-cli[audio]"`.

```bash
# Download audio and split into ASR-ready WAV segments (25s each, 16kHz mono)
bili audio BV1ABcsztEcY                 # Split to /tmp/bilibili-cli/{title}/
bili audio BV1ABcsztEcY --segment 60    # 60s per segment
bili audio BV1ABcsztEcY --no-split      # Full m4a file, no splitting
bili audio BV1ABcsztEcY -o ~/data/      # Custom output directory
```

### Interactions (require login)

```bash
bili like BV1ABcsztEcY         # Like a video
bili like BV1ABcsztEcY --undo  # Unlike
bili coin BV1ABcsztEcY         # Give 1 coin
bili coin BV1ABcsztEcY -n 2    # Give 2 coins
bili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)
bili unfollow 946974           # Unfollow by UID
```

### Account

```bash
bili status                    # Quick login check
bili status --yaml             # Structured auth status
bili whoami                    # Detailed profile info
bili whoami --yaml              # Profile as YAML
bili whoami --json              # Profile as JSON
bili login                     # QR code login
bili logout                    # Clear credentials
```

## Structured Output

Major query commands support both `--yaml` and `--json` for machine-readable output. Prefer YAML for agent use:

```bash
bili status --yaml                                # Quick structured auth check
bili video BV1ABcsztEcY --yaml                       # Preferred for AI agents
bili hot --max 5 --yaml                             # Smaller, token-efficient payload
bili user 946974 --json | jq -r '.data.user.name'   # JSON when jq is needed
```

When stdout is not a TTY, `bilibili-cli` defaults to YAML automatically.
Use `OUTPUT=yaml|json|rich|auto` to override the default output mode.
All machine-readable output uses the envelope documented in [SCHEMA.md](./SCHEMA.md).

## Debugging

```bash
bili -v <command>              # Enable verbose/debug logging for any command
```

## Common Patterns for AI Agents

```bash
# For video summarization, fetch subtitles first
bili video BV1ABcsztEcY --subtitle

# Only use AI summary as a fallback or secondary signal
bili video BV1ABcsztEcY --ai

# Get comments for sentiment analysis
bili video BV1ABcsztEcY --comments

# Extract audio for speech-to-text (ASR)
# Segments are saved to /tmp/bilibili-cli/{title}/seg_000.wav, seg_001.wav, ...
bili audio BV1ABcsztEcY --segment 25

# Find a user's latest video BV ID with minimal payload
bili user-videos 946974 --max 1 --yaml

# Check if logged in before performing actions
bili status && bili like BV1ABcsztEcY

# Search and inspect the first few results
bili search "topic" --type video --max 3 --yaml
```

### Workflow: Video Content Analysis

```bash
# 1. Search for a topic
bili search "AI" --type video --max 5

# 2. Get subtitles first for summarization
bili video BV1xxx --subtitle

# 3. If subtitles are missing or incomplete, try AI summary
bili video BV1xxx --ai

# 4. If there is still not enough content, extract audio for ASR
bili audio BV1xxx --segment 25

# 5. Get comments for audience reaction
bili video BV1xxx --comments
```

### Workflow: UP主 Research

```bash
# 1. Look up UP主 profile
bili user "影视飓风"

# 2. Get their recent videos
bili user-videos 946974 --max 10

# 3. Inspect a specific video
bili video BV1xxx --ai --comments
```

## Error Handling

- Commands exit with code 0 on success, non-zero on failure
- Error messages are prefixed with ❌
- Login-required commands show ⚠️ with instruction to run `bili login`
- Invalid BV IDs show a clear error message

## Safety Notes

- Do not ask users to share raw credential/cookie values in chat logs.
- Prefer local browser cookie extraction over manual secret copy/paste.
- If auth fails, ask the user to re-login via `bili login`.

Related Skills

bilibili-downloader

3891
from openclaw/skills

Download videos, audio, subtitles, and covers from Bilibili using bilibili-api. Use when working with Bilibili content for downloading videos in various qualities, extracting audio, getting subtitles and danmaku, downloading covers, and managing download preferences.

bilibili-subtitle

3891
from openclaw/skills

处理 B 站(哔哩哔哩)视频字幕的完整工作流。能力包括:(1)引导用户扫码登录获取 Cookie;(2)自动获取视频字幕(优先 AI 字幕,自动回退 CC 字幕);(3)生成视频内容摘要;(4)当用户询问"某内容在哪个时间段"时,从字幕文件中精准定位时间戳。当用户提供 B 站视频链接、BVID,或提到"b站字幕""帮我看视频""视频摘要""视频哪里讲到了""字幕提取"等任何与 B 站视频内容理解相关的场景时,务必使用此 skill。即使用户只是随口提到一个 bilibili 链接,也应该触发此 skill。

Bilibili

3891
from openclaw/skills

Design videos for cultural resonance on Bilibili. Analyze danmu psychology, meme triggers, collective reaction points, and community-native emotional beats to increase deep engagement.

bilibili-transcript

3891
from openclaw/skills

Transcribe Bilibili videos to text with high accuracy using Whisper medium model. Use when the user provides a Bilibili video URL (BVxxxxx) and wants to: (1) Extract the complete audio content as text with high accuracy, (2) Get a detailed summary of the video content, (3) Save the transcript as a formatted TXT file instead of posting long text to Discord. Automatically detects CC subtitles if available, otherwise uses Whisper medium model with GPU acceleration. Output saves to 'Bilibili transcript' folder by default, includes video metadata, summary section, and full transcript in Simplified Chinese.

bilibili-ai-subtitle

3891
from openclaw/skills

Download Bilibili AI-generated subtitles (auto-subtitles) for videos. Use when you need to quickly get subtitles from Bilibili videos that have AI-generated captions. Supports 9 languages: Chinese, English, Japanese, Spanish, Arabic, Portuguese, Korean, German, French. Language priority can be customized.

bilibili-insight

3891
from openclaw/skills

B 站 UP 主分析、视频数据追踪、粉丝画像、爆款内容拆解。适合内容创作者、品牌方、MCN 机构。

jkvideo-bilibili-react-native

3819
from openclaw/skills

Expert skill for building and extending JKVideo, a React Native Bilibili-like client with DASH playback, danmaku, WBI signing, and live streaming

openakita/skills@bilibili-watcher

1592
from openakita/openakita

Extract subtitles and transcripts from Bilibili and YouTube videos. Use when the user wants to get subtitles from B站 (Bilibili) or YouTube, extract Chinese/Japanese video transcripts, watch member-only Bilibili content, or perform Q&A on video content. Supports dual-platform subtitle extraction with yt-dlp.

compose-multiplatform-patterns

144923
from affaan-m/everything-claude-code

KMP项目中的Compose Multiplatform和Jetpack Compose模式——状态管理、导航、主题化、性能优化和平台特定UI。

java-coding-standards

144923
from affaan-m/everything-claude-code

Spring Bootサービス向けのJavaコーディング標準:命名、不変性、Optional使用、ストリーム、例外、ジェネリクス、プロジェクトレイアウト。

continuous-learning

144923
from affaan-m/everything-claude-code

Claude Codeセッションから再利用可能なパターンを自動的に抽出し、将来の使用のために学習済みスキルとして保存します。

nextjs-best-practices

31392
from sickn33/antigravity-awesome-skills

Next.js App Router principles. Server Components, data fetching, routing patterns.