{"id":"feadc2c6-bcf2-4207-8584-9e22069c67fe","entityType":"agent","slug":"clawhub-jackwener-bilibili-cli","name":"bilibili-cli","canonicalUrl":"https://www.xpersona.co/agent/clawhub-jackwener-bilibili-cli","canonicalPath":"/agent/clawhub-jackwener-bilibili-cli","generatedAt":"2026-10-11T14:13:40.345Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":null},"description":"CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact... Skill: bilibili-cli Owner: jackwener Summary: CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact... Tags: latest:0.6.0 Version history: v0.6.0 | 2026-03-10T16:30:53.890Z | user Release 0.6.0 v0.5.0 | 2026-03-10T07:34:06.326Z | user Release 0.5.0 v0.4.1 | 2026-03-08T18:15:27.325Z | user Sync SKILL.md: add Chinese","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s176j4v65c2r3ydppd13q6pm0h885k6x:bilibili-cli","sourceUrl":"https://clawhub.ai/jackwener/bilibili-cli","homepage":"https://clawhub.ai/jackwener/skills/bilibili-cli","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/jackwener/bilibili-cli","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/jackwener/skills/bilibili-cli","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":61,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":null},"stars":null,"forks":null,"downloads":1080,"packageName":null,"latestVersion":"0.6.0","tractionLabel":"1.1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:10:07.593Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T11:10:07.606Z","lastCrawledAt":"2026-10-11T11:10:07.593Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T11:10:07.593Z","lastVerifiedAt":null,"highlights":[{"version":"0.6.0","createdAt":"2026-03-10T16:30:53.890Z","changelog":"Release 0.6.0","fileCount":31,"zipByteSize":63839},{"version":"0.5.0","createdAt":"2026-03-10T07:34:06.326Z","changelog":"Release 0.5.0","fileCount":26,"zipByteSize":53035},{"version":"0.4.1","createdAt":"2026-03-08T18:15:27.325Z","changelog":"Sync SKILL.md: add Chinese tags, uv-first install, safety notes, workflows","fileCount":24,"zipByteSize":48975},{"version":"0.4.0","createdAt":"2026-03-05T16:09:13.442Z","changelog":"Release 0.4.0","fileCount":24,"zipByteSize":48363},{"version":"0.1.0","createdAt":"2026-03-04T12:08:35.760Z","changelog":"Initial release — 17 commands for browsing Bilibili from the terminal","fileCount":14,"zipByteSize":22296}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s176j4v65c2r3ydppd13q6pm0h885k6x:bilibili-cli","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T14:13:40.343Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jackwener-bilibili-cli/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":null},"readme":"Skill: bilibili-cli\n\nOwner: jackwener\n\nSummary: CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact...\n\nTags: latest:0.6.0\n\nVersion history:\n\nv0.6.0 | 2026-03-10T16:30:53.890Z | user\n\nRelease 0.6.0\n\nv0.5.0 | 2026-03-10T07:34:06.326Z | user\n\nRelease 0.5.0\n\nv0.4.1 | 2026-03-08T18:15:27.325Z | user\n\nSync SKILL.md: add Chinese tags, uv-first install, safety notes, workflows\n\nv0.4.0 | 2026-03-05T16:09:13.442Z | user\n\nRelease 0.4.0\n\nv0.1.0 | 2026-03-04T12:08:35.760Z | user\n\nInitial release — 17 commands for browsing Bilibili from the terminal\n\nArchive index:\n\nArchive v0.6.0: 31 files, 63839 bytes\n\nFiles: bili_cli/__init__.py (81b), bili_cli/auth.py (13508b), bili_cli/cli.py (2139b), bili_cli/client.py (26669b), bili_cli/commands/__init__.py (27b), bili_cli/commands/account.py (4316b), bili_cli/commands/audio.py (4125b), bili_cli/commands/collections.py (19138b), bili_cli/commands/common.py (4364b), bili_cli/commands/discovery.py (3740b), bili_cli/commands/interactions.py (4190b), bili_cli/commands/user_search.py (7615b), bili_cli/commands/video.py (7079b), bili_cli/exceptions.py (622b), bili_cli/formatter.py (4880b), bili_cli/payloads.py (10920b), CHANGELOG.md (375b), pyproject.toml (1766b), README.md (18268b), SCHEMA.md (988b), skill-card.md (2341b), SKILL.md (7933b), tests/conftest.py (1247b), tests/test_audio.py (7665b), tests/test_auth.py (10307b), tests/test_cli.py (39661b), tests/test_client.py (18853b), tests/test_helpers.py (2464b), tests/test_smoke.py (2336b), tests/test_subtitle.py (1596b), _meta.json (131b)\n\nFile v0.6.0:SKILL.md\n\n---\nname: bilibili-cli\ndescription: 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\nauthor: jackwener\nversion: \"1.0.0\"\ntags:\n  - bilibili\n  - 哔哩哔哩\n  - b站\n  - video\n  - social-media\n  - cli\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Agent Defaults\n\nWhen you need machine-readable output:\n\n1. Prefer `--yaml` first because it is usually more token-efficient than pretty JSON.\n2. Use `--json` only when downstream tooling strictly requires JSON.\n3. Keep result sets small with `--max`, `--page`, or `--offset`.\n4. Prefer specific commands over broad ones. Example: use `bili user-videos 946974 --max 3 --yaml` instead of fetching large timelines.\n5. When summarizing a video, fetch subtitles first. Subtitles usually contain the video's core content and are the best primary source for summaries.\n6. Only fall back to `--ai`, comments, or audio extraction when subtitles are unavailable or clearly insufficient.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\nuv tool install bilibili-cli\n# Or: pipx install bilibili-cli\n\n# If you need audio extraction support (requires PyAV)\nuv tool install \"bilibili-cli[audio]\"\n# Or: pipx install \"bilibili-cli[audio]\"\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in (exit 0 = yes, 1 = no)\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication 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`.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle            # Show subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline   # Show subtitles with timestamps\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT format\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --yaml          # Token-efficient YAML output\nbili video BV1ABcsztEcY --json          # Structured JSON envelope\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --yaml\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n\n# Pagination and limit\nbili search \"关键词\" --type video --max 5\nbili search \"关键词\" --page 2\n```\n\n### Discovery\n\n```bash\nbili hot                       # Trending/popular videos\nbili hot --page 2 --max 10     # Page 2, limit 10\nbili rank                      # Site-wide ranking (3-day)\nbili rank --day 7 --max 30     # 7-day ranking, top 30\nbili feed                      # Dynamic timeline (requires login)\nbili feed --offset 1234567890  # Next page via returned cursor\nbili my-dynamics               # My posted dynamics (requires login)\nbili dynamic-post \"hello\"      # Publish text dynamic (requires write credential)\nbili dynamic-delete 123456789  # Delete one dynamic (requires write credential)\n```\n\n### Collections (require login)\n\n```bash\nbili favorites                 # List favorite folders\nbili favorites <ID> --page 2   # Videos in a folder\nbili following                 # Following list\nbili watch-later               # Watch later list\nbili history                   # Watch history\n```\n\n### Audio Extraction\n\nRequires `bilibili-cli[audio]` extra (PyAV). Install with `uv tool install \"bilibili-cli[audio]\"`.\n\n```bash\n# Download audio and split into ASR-ready WAV segments (25s each, 16kHz mono)\nbili audio BV1ABcsztEcY                 # Split to /tmp/bilibili-cli/{title}/\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a file, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n```\n\n### Interactions (require login)\n\n```bash\nbili like BV1ABcsztEcY         # Like a video\nbili like BV1ABcsztEcY --undo  # Unlike\nbili coin BV1ABcsztEcY         # Give 1 coin\nbili coin BV1ABcsztEcY -n 2    # Give 2 coins\nbili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)\nbili unfollow 946974           # Unfollow by UID\n```\n\n### Account\n\n```bash\nbili status                    # Quick login check\nbili status --yaml             # Structured auth status\nbili whoami                    # Detailed profile info\nbili whoami --yaml              # Profile as YAML\nbili whoami --json              # Profile as JSON\nbili login                     # QR code login\nbili logout                    # Clear credentials\n```\n\n## Structured Output\n\nMajor query commands support both `--yaml` and `--json` for machine-readable output. Prefer YAML for agent use:\n\n```bash\nbili status --yaml                                # Quick structured auth check\nbili video BV1ABcsztEcY --yaml                       # Preferred for AI agents\nbili hot --max 5 --yaml                             # Smaller, token-efficient payload\nbili user 946974 --json | jq -r '.data.user.name'   # JSON when jq is needed\n```\n\nWhen stdout is not a TTY, `bilibili-cli` defaults to YAML automatically.\nUse `OUTPUT=yaml|json|rich|auto` to override the default output mode.\nAll machine-readable output uses the envelope documented in [SCHEMA.md](./SCHEMA.md).\n\n## Debugging\n\n```bash\nbili -v <command>              # Enable verbose/debug logging for any command\n```\n\n## Common Patterns for AI Agents\n\n```bash\n# For video summarization, fetch subtitles first\nbili video BV1ABcsztEcY --subtitle\n\n# Only use AI summary as a fallback or secondary signal\nbili video BV1ABcsztEcY --ai\n\n# Get comments for sentiment analysis\nbili video BV1ABcsztEcY --comments\n\n# Extract audio for speech-to-text (ASR)\n# Segments are saved to /tmp/bilibili-cli/{title}/seg_000.wav, seg_001.wav, ...\nbili audio BV1ABcsztEcY --segment 25\n\n# Find a user's latest video BV ID with minimal payload\nbili user-videos 946974 --max 1 --yaml\n\n# Check if logged in before performing actions\nbili status && bili like BV1ABcsztEcY\n\n# Search and inspect the first few results\nbili search \"topic\" --type video --max 3 --yaml\n```\n\n### Workflow: Video Content Analysis\n\n```bash\n# 1. Search for a topic\nbili search \"AI\" --type video --max 5\n\n# 2. Get subtitles first for summarization\nbili video BV1xxx --subtitle\n\n# 3. If subtitles are missing or incomplete, try AI summary\nbili video BV1xxx --ai\n\n# 4. If there is still not enough content, extract audio for ASR\nbili audio BV1xxx --segment 25\n\n# 5. Get comments for audience reaction\nbili video BV1xxx --comments\n```\n\n### Workflow: UP主 Research\n\n```bash\n# 1. Look up UP主 profile\nbili user \"影视飓风\"\n\n# 2. Get their recent videos\nbili user-videos 946974 --max 10\n\n# 3. Inspect a specific video\nbili video BV1xxx --ai --comments\n```\n\n## Error Handling\n\n- Commands exit with code 0 on success, non-zero on failure\n- Error messages are prefixed with ❌\n- Login-required commands show ⚠️ with instruction to run `bili login`\n- Invalid BV IDs show a clear error message\n\n## Safety Notes\n\n- Do not ask users to share raw credential/cookie values in chat logs.\n- Prefer local browser cookie extraction over manual secret copy/paste.\n- If auth fails, ask the user to re-login via `bili login`.\n\nFile v0.6.0:README.md\n\n# bilibili-cli\n\n[![CI](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml)\n[![PyPI version](https://img.shields.io/pypi/v/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![Python versions](https://img.shields.io/pypi/pyversions/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## More Projects\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — Xiaohongshu CLI tooling\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI tooling\n- [discord-cli](https://github.com/jackwener/discord-cli) — Discord CLI for local-first chat sync and search\n- [tg-cli](https://github.com/jackwener/tg-cli) — Telegram CLI for local-first sync, search, and export\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 🎵 **Audio** — extract audio and split into ASR-ready WAV segments\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- 🔥 **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- 📂 **Favorites** — browse favorite folders, watch-later, and watch history\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **Structured output** — major query commands support `--yaml` and `--json`\n- 🤖 **Agent-friendly defaults** — non-TTY stdout defaults to YAML; override with `OUTPUT=yaml|json|rich|auto`\n- 📦 **Stable envelope** — see [SCHEMA.md](./SCHEMA.md) for `ok/schema_version/data/error`\n- 🧱 **Normalized payloads** — command-layer output is normalized instead of leaking raw upstream SDK responses\n\n## Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install bilibili-cli\n\n# Or: pipx\npipx install bilibili-cli\n\n# If you need audio extraction support\nuv tool install \"bilibili-cli[audio]\"\n# or\npipx install \"bilibili-cli[audio]\"\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\nRun tests in the project environment:\n\n```bash\nuv sync --extra dev\nuv run pytest -q\nuv run ruff check .\nuv run python -m mypy bili_cli\n```\n\nIf the project directory was moved and stale virtualenv wrappers remain, rerun:\n\n```bash\nuv sync --extra dev --reinstall\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili status --yaml             # Structured auth status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\nbili whoami --yaml             # Structured profile\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      # With subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline        # With timeline\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT\nbili video BV1ABcsztEcY --ai            # AI summary\nbili video BV1ABcsztEcY --comments      # Top comments\nbili video BV1ABcsztEcY --related       # Related videos\nbili video BV1ABcsztEcY --yaml          # Agent-friendly YAML\nbili video BV1ABcsztEcY --json          # Normalized JSON envelope\nbili video BV1ABcsztEcY --subtitle-timeline --comments --json  # Extras in one payload\n\n# Users\nbili user 946974                        # UP profile\nbili user \"影视飓风\"                     # Search by name\nbili user-videos 946974 --max 20        # Video list\n\n# Discovery\nbili hot                                # Trending videos (page 1)\nbili hot --page 2 --max 10              # Page 2, top 10\nbili rank                               # Site-wide ranking (3-day)\nbili rank --day 7 --max 30              # 7-day ranking, top 30\nbili search \"关键词\"                     # Search users\nbili search \"关键词\" --type video --max 5 # Search videos (top 5)\nbili search \"关键词\" --page 2            # Next page\nbili feed                               # Dynamic timeline\nbili feed --offset 1234567890           # Next page via returned cursor\nbili my-dynamics                         # My posted dynamics\nbili dynamic-post \"抽个奖，明天开奖\"       # Publish text dynamic\nbili dynamic-delete 123456789012345678   # Delete one dynamic\n\n# Collections\nbili favorites                          # Favorite folders\nbili favorites <ID> --page 2            # Videos in a folder\nbili following                          # Following list\nbili watch-later                        # Watch later\nbili history                            # Watch history\n\n# Audio extraction\nbili audio BV1ABcsztEcY                 # Download + split into 25s WAV segments\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n\n# Interactions\nbili like BV1ABcsztEcY                  # Like\nbili coin BV1ABcsztEcY                  # Give coin\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # Unfollow by UID\nbili like BV1ABcsztEcY --json           # Structured write result\nbili coin BV1ABcsztEcY --yaml           # Structured write result\n```\n\n## Authentication\n\nbilibili-cli uses a 3-tier authentication strategy:\n\n1. **Saved credential** — loads from `~/.bilibili-cli/credential.json`\n2. **Browser cookies** — auto-extracts from Chrome, Firefox, Edge, or Brave\n3. **QR code login** — `bili login` displays a QR code in the terminal\n\nCredentials are validated on use for authenticated commands. Expired cookies are automatically cleared, while transient network validation failures keep local credentials for best-effort fallback.\n`bili status` exits with code `0` only when authenticated; otherwise it exits with `1`.\n\nMost commands work without login. Subtitles, favorites/following/watch-later/history, feed, my-dynamics, and interactions require authentication. Write actions (like/coin/triple/unfollow/dynamic-post/dynamic-delete) require write-capable credential (`bili_jct`).\n\nAudio extraction requires the optional `audio` dependency group (`av`).\n\n## Structured Output\n\nAll `--json` / `--yaml` output uses the shared envelope from [SCHEMA.md](./SCHEMA.md).\nMajor commands now emit normalized payloads instead of raw upstream SDK blobs:\n\n- `bili video` → `data.video`, `data.subtitle`, `data.ai_summary`, `data.comments`, `data.related`, `data.warnings`\n- `bili hot` / `bili rank` → `data.items`\n- `bili search` → normalized user/video lists\n- `bili like` / `bili coin` / `bili triple` / `bili unfollow` → normalized write-action results\n\nStructured errors now use more specific codes such as `not_authenticated`, `permission_denied`, `invalid_input`, `network_error`, `upstream_error`, and `not_found`.\n\n## Use as AI Agent Skill\n\nbilibili-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.\n\n### Agent Output Recommendation\n\nIf an AI agent needs machine-readable output, prefer `--yaml` first:\n\n- `--yaml` is usually more token-efficient than pretty-printed JSON\n- It is still easy to parse for agents and scripts\n- Keep `--json` for `jq`, strict JSON-only tooling, or exact downstream schemas\n- Non-TTY stdout defaults to YAML automatically\n- Use `OUTPUT=yaml|json|rich|auto` to override the default mode\n\nExamples:\n\n```bash\nbili status --yaml\nbili video BV1ABcsztEcY --yaml\nbili hot --max 5 --yaml\nbili user-videos 946974 --max 3 --yaml\n```\n\nFor agent usage, also prefer narrower queries (`--max`, `--page`, `--offset`) to avoid wasting context on oversized payloads.\n\nWhen an AI agent is asked to summarize a video, it should fetch subtitles first. Subtitles usually contain the core content of the video and are the best primary source for summarization. Only fall back to AI summary, comments, or audio extraction when subtitles are unavailable or insufficient.\n\n### Claude Code / Antigravity\n\n```bash\n# Clone into your project's skills directory\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# Or just copy the SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\nOnce added, AI agents that support the `.agents/skills/` convention will automatically discover and use bilibili-cli commands.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install bilibili-cli\n```\n\nAll bilibili-cli commands are available in OpenClaw after installation.\n\n## Troubleshooting\n\n- `需要登录` / `not_authenticated` — Run `bili login` to scan QR code, or ensure you're logged in to bilibili.com in Chrome/Firefox/Edge/Brave.\n- `HTTP 412` / `RateLimitError` — Bilibili anti-scraping triggered. Wait a moment and retry, or reduce `--max`.\n- `无法提取 BV 号` / `InvalidBvidError` — Check the BV ID or URL format. Must be `BV` followed by 10 alphanumeric characters.\n- `NetworkError` — Check your network connection. If behind a proxy, ensure it supports the target domain.\n- `当前登录凭证不支持写操作` — Your saved cookies lack `bili_jct`. Run `bili login` to re-authorize with full write permission.\n\nStructured error codes: `not_authenticated`, `permission_denied`, `invalid_input`, `network_error`, `upstream_error`, `not_found`, `rate_limited`, `internal_error`.\n\n---\n\n## 推荐项目\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — 小红书 CLI 工具\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI 工具\n- [discord-cli](https://github.com/jackwener/discord-cli) — Discord 本地优先同步、检索与导出 CLI\n- [tg-cli](https://github.com/jackwener/tg-cli) — Telegram 本地优先同步、检索与导出 CLI\n\n## 功能特性\n\n- 🎬 **视频** — 详情、字幕、AI 总结、评论、相关推荐\n- 🎵 **音频** — 提取视频音频，切分为语音识别 (ASR) 可用的 WAV 片段\n- 👤 **用户** — UP 主资料、视频列表、关注列表\n- 🔍 **搜索** — 按关键词搜索用户或视频\n- 🔥 **发现** — 热门视频、全站排行榜\n- 📰 **动态** — 关注的人的动态时间线\n- 📂 **收藏** — 收藏夹浏览、稍后再看、观看历史\n- 👍 **互动** — 点赞、投币、一键三连\n- 🔐 **智能认证** — 自动提取浏览器 Cookie，或扫码登录\n- 📊 **结构化输出** — 主要查询命令支持 `--yaml` 和 `--json`\n- 🤖 **更适合 Agent** — stdout 不是 TTY 时默认输出 YAML，也可以用 `OUTPUT=yaml|json|rich|auto` 覆盖\n- 🧱 **规范化 payload** — 结构化输出在命令层做了收口，不再直接暴露原始上游 SDK 返回\n\n## 安装\n\n```bash\n# 推荐：uv tool（快速、隔离环境）\nuv tool install bilibili-cli\n\n# 或者：pipx\npipx install bilibili-cli\n\n# 如果需要音频提取功能\nuv tool install \"bilibili-cli[audio]\"\n# 或\npipx install \"bilibili-cli[audio]\"\n```\n\n或从源码安装：\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n开发环境验证：\n\n```bash\nuv sync --extra dev\nuv run pytest -q\nuv run ruff check .\nuv run python -m mypy bili_cli\n```\n\n如果项目目录发生过移动，导致旧的 virtualenv wrapper 失效，可重新执行：\n\n```bash\nuv sync --extra dev --reinstall\n```\n\n## 使用示例\n\n```bash\n# 登录与账号\nbili status                    # 检查登录状态\nbili status --yaml             # 结构化认证状态\nbili login                     # 扫码登录\nbili whoami                    # 查看个人信息（等级、硬币、粉丝数）\nbili whoami --yaml             # 结构化个人信息\n\n# 视频\nbili video BV1ABcsztEcY                 # 视频详情\nbili video BV1ABcsztEcY --subtitle      # 显示字幕（纯文本）\nbili video BV1ABcsztEcY --subtitle-timeline        # 显示带时间线的字幕\nbili video BV1ABcsztEcY -st --subtitle-format srt  # 导出为 SRT\nbili video BV1ABcsztEcY --ai            # AI 总结\nbili video BV1ABcsztEcY --comments      # 热门评论\nbili video BV1ABcsztEcY --related       # 相关推荐\nbili video BV1ABcsztEcY --yaml          # 适合 AI Agent 的 YAML\nbili video BV1ABcsztEcY --json          # 规范化 JSON envelope\nbili video BV1ABcsztEcY --subtitle-timeline --comments --json  # 额外内容也会进入 payload\n\n# 用户\nbili user 946974                        # UP 主资料\nbili user \"影视飓风\"                     # 按用户名搜索\nbili user-videos 946974 --max 20        # 视频列表\n\n# 发现\nbili hot                                # 热门视频（第1页）\nbili hot --page 2 --max 10              # 第2页，前10条\nbili rank                               # 全站排行榜（3日）\nbili rank --day 7 --max 30              # 7日榜，前30条\nbili search \"关键词\"                     # 搜索用户\nbili search \"关键词\" --type video --max 5 # 搜索视频（前5条）\nbili search \"关键词\" --page 2            # 第2页结果\nbili feed                               # 动态时间线\nbili feed --offset 1234567890           # 使用上一页游标翻页\nbili my-dynamics                         # 我发布的动态\nbili dynamic-post \"抽个奖，明天开奖\"       # 发布文字动态\nbili dynamic-delete 123456789012345678   # 删除单条动态\n\n# 收藏\nbili favorites                          # 收藏夹列表\nbili following                          # 关注列表\nbili watch-later                        # 稍后再看\nbili history                            # 观看历史\n\n# 音频提取\nbili audio BV1ABcsztEcY                 # 下载并切分为 25 秒 WAV 片段\nbili audio BV1ABcsztEcY --segment 60    # 每段 60 秒\nbili audio BV1ABcsztEcY --no-split      # 完整 m4a，不切分\nbili audio BV1ABcsztEcY -o ~/data/      # 自定义输出目录\n\n# 互动\nbili like BV1ABcsztEcY                  # 点赞\nbili coin BV1ABcsztEcY                  # 投币\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # 取消关注（按 UID）\nbili like BV1ABcsztEcY --json           # 结构化写操作结果\nbili coin BV1ABcsztEcY --yaml           # 结构化写操作结果\n```\n\n## 认证策略\n\nbilibili-cli 采用三级认证策略：\n\n1. **已保存凭证** — 从 `~/.bilibili-cli/credential.json` 加载\n2. **浏览器 Cookie** — 自动从 Chrome、Firefox、Edge、Brave 提取\n3. **扫码登录** — `bili login` 在终端显示二维码\n\n需要认证的命令会自动校验凭证。过期 Cookie 会自动清除；如果只是临时网络异常，不会误清本地凭证（会以 best-effort 继续尝试）。\n\n大部分命令无需登录。字幕、收藏夹、动态和互动操作需要登录。写操作（like/coin/triple/unfollow/dynamic-post/dynamic-delete）需要可写凭证（包含 `bili_jct`）。\n\n## 结构化输出\n\n所有 `--json` / `--yaml` 输出都使用 [SCHEMA.md](./SCHEMA.md) 里的 envelope。\n主要命令现在会返回命令层规范化后的 payload，例如：\n\n- `bili video` → `data.video`、`data.subtitle`、`data.ai_summary`、`data.comments`、`data.related`、`data.warnings`\n- `bili hot` / `bili rank` → `data.items`\n- `bili search` → 规范化后的用户或视频列表\n- `bili like` / `bili coin` / `bili triple` / `bili unfollow` → 标准化写操作结果\n\n结构化错误码也区分成了 `not_authenticated`、`permission_denied`、`invalid_input`、`network_error`、`upstream_error`、`not_found` 等类型，便于脚本或 agent 做恢复和分支处理。\n\n## AI Agent 使用建议\n\n如果 AI Agent 需要机器可读输出，默认优先 `--yaml`：\n\n- `--yaml` 通常比格式化 JSON 更省 token\n- 对 agent 来说仍然容易解析\n- 只有在要配合 `jq` 或下游必须是 JSON 时，再使用 `--json`\n- stdout 不是 TTY 时会默认自动输出 YAML\n- 也可以用 `OUTPUT=yaml|json|rich|auto` 强制覆盖默认输出模式\n\n示例：\n\n```bash\nbili status --yaml\nbili video BV1ABcsztEcY --yaml\nbili hot --max 5 --yaml\nbili user-videos 946974 --max 3 --yaml\n```\n\n另外，agent 应尽量配合 `--max`、`--page`、`--offset` 缩小结果集，避免把不必要的数据带进上下文。\n\n如果 agent 要帮用户总结视频，应该优先拉字幕。字幕通常就是视频核心内容的第一手来源，最适合做 summary；只有在没有字幕或字幕明显不足时，再退回到 AI summary、评论或音频提取。\n\n音频提取功能需要安装可选依赖组 `audio`（即 `av`）。\n\n## 作为 AI Agent Skill 使用\n\nbilibili-cli 自带 [`SKILL.md`](./SKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### Claude Code / Antigravity\n\n```bash\n# 克隆到项目的 skills 目录\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# 或者只复制 SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\n添加后，支持 `.agents/skills/` 的 AI Agent 会自动发现并使用 bilibili-cli 命令。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install bilibili-cli\n```\n\n安装后即可在 OpenClaw 中直接使用所有 bilibili-cli 命令。\n\n## 常见问题\n\n- `需要登录` — 执行 `bili login` 扫码登录，或确保已在 Chrome/Firefox/Edge/Brave 登录 bilibili.com\n- `HTTP 412` / `RateLimitError` — B 站反爬触发，稍等后重试，或减小 `--max`\n- `无法提取 BV 号` — 检查 BV 号或 URL 格式，必须是 `BV` + 10 位字母数字\n- `NetworkError` — 检查网络连接\n- `当前登录凭证不支持写操作` — 保存的 Cookie 缺少 `bili_jct`，执行 `bili login` 重新授权\n\n## License\n\nApache-2.0\n\nFile v0.6.0:_meta.json\n\n{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.6.0\",\n  \"publishedAt\": 1773160253890\n}\n\nFile v0.6.0:CHANGELOG.md\n\n# Changelog\n\n## 0.5.0\n\n- Add subtitle timeline output via `bili video --subtitle-timeline` / `-st`\n- Add `--subtitle-format timeline|srt`\n- Keep subtitle timeline compatible with current `--yaml` / `--json` command surface\n- Ensure subtitle timeline requests load optional credentials like plain subtitles\n- Restore README badges and fix CI type-checking with `types-PyYAML`\n\nFile v0.6.0:SCHEMA.md\n\n# Structured Output Schema\n\n`bilibili-cli` uses a shared agent-friendly envelope for machine-readable output.\n\n## Success\n\n```yaml\nok: true\nschema_version: \"1\"\ndata: ...\n```\n\n## Error\n\n```yaml\nok: false\nschema_version: \"1\"\nerror:\n  code: api_error\n  message: 未找到用户: foo\n```\n\n## Notes\n\n- `--yaml` and `--json` both use this envelope\n- non-TTY stdout defaults to YAML\n- command payloads are normalized at the CLI layer\n- list-like results are typically returned under `data.items`\n- `status` returns `data.authenticated` plus `data.user`\n- `whoami` returns `data.user` and `data.relation`\n- `video` returns `data.video`, `data.subtitle`, `data.ai_summary`, `data.comments`, `data.related`, and `data.warnings`\n- write commands return normalized action payloads with `data.success` and `data.action`\n\n## Error Codes\n\nCommon structured error codes:\n\n- `not_authenticated`\n- `permission_denied`\n- `invalid_input`\n- `network_error`\n- `upstream_error`\n- `not_found`\n- `internal_error`\n\nFile v0.6.0:skill-card.md\n\n## Description:\n\nCLI skill for Bilibili with token-efficient YAML output for AI agents to browse videos, users, search results, trending content, dynamics, favorites, and interactions from the terminal.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[jackwener](https://clawhub.ai/user/jackwener)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal developers and AI agents use this skill to inspect Bilibili videos, users, feeds, collections, subtitles, comments, and account interactions from a terminal. It is especially useful when an agent needs compact YAML or JSON outputs for video research and summarization workflows.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The tool can read local Bilibili browser cookies and store reusable session credentials.\n\nMitigation: Prefer QR login when possible, avoid sharing raw cookies or credential files, and clear saved credentials with `bili logout` when work is complete.\n\nRisk: Authenticated commands can change the user's Bilibili account state, including likes, coins, favorites, follows, and dynamic posts.\n\nMitigation: Review account-changing commands before execution and require explicit user approval for write actions.\n\nRisk: Audio extraction can create local media files from Bilibili videos.\n\nMitigation: Approve audio extraction only when local files are expected and use a deliberate output directory.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/jackwener/skills/bilibili-cli)\n- [Structured Output Schema](./SCHEMA.md)\n- [bilibili-cli PyPI project](https://pypi.org/project/bilibili-cli/)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with shell commands and YAML or JSON command outputs]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Prefers compact YAML for agent workflows; JSON is available for strict downstream tooling.]\n\n## Skill Version(s):\n\n0.6.0 (source: server release metadata and pyproject.toml)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v0.6.0:pyproject.toml\n\n[project]\nname = \"bilibili-cli\"\nversion = \"0.6.0\"\ndescription = \"A CLI for Bilibili — browse videos, users, favorites from the terminal\"\nreadme = \"README.md\"\nlicense = \"Apache-2.0\"\nrequires-python = \">=3.10\"\nauthors = [{ name = \"jackwener\", email = \"jakevingoo@gmail.com\" }]\nkeywords = [\"bilibili\", \"cli\", \"terminal\", \"video\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"License :: OSI Approved :: Apache Software License\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia :: Video\",\n]\ndependencies = [\n    \"bilibili-api-python>=16.0\",\n    \"click>=8.0\",\n    \"rich>=13.0\",\n    \"aiohttp>=3.0\",\n    \"browser-cookie3>=0.19\",\n    \"pyyaml>=6.0\",\n    \"qrcode>=7.0\",\n]\n\n[project.optional-dependencies]\naudio = [\n    \"av>=14.0\",\n]\ndev = [\n    \"pytest>=8.0\",\n    \"pytest-asyncio>=0.23\",\n    \"pytest-mock>=3.0\",\n    \"ruff>=0.11.0\",\n    \"mypy>=1.15.0\",\n    \"types-PyYAML>=6.0.12\",\n    \"av>=14.0\",\n]\n\n[project.urls]\nHomepage = \"https://github.com/jackwener/bilibili-cli\"\nRepository = \"https://github.com/jackwener/bilibili-cli\"\nIssues = \"https://github.com/jackwener/bilibili-cli/issues\"\n\n[project.scripts]\nbili = \"bili_cli.cli:cli\"\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"bili_cli\"]\n\n[tool.ruff]\ntarget-version = \"py310\"\nline-length = 140\n\n[tool.ruff.lint]\nselect = [\"E\", \"F\", \"I\", \"B\", \"UP\"]\n\n[tool.mypy]\npython_version = \"3.10\"\nignore_missing_imports = true\ncheck_untyped_defs = true\nwarn_unused_ignores = true\nno_implicit_optional = true\n\n[tool.pytest.ini_options]\ntestpaths = [\"tests\"]\npython_files = [\"test_*.py\"]\naddopts = \"-m 'not smoke'\"\nmarkers = [\n    \"smoke: real-API integration tests (run with: pytest -m smoke)\",\n]\n\nArchive v0.5.0: 26 files, 53035 bytes\n\nFiles: bili_cli/__init__.py (81b), bili_cli/auth.py (11983b), bili_cli/cli.py (2139b), bili_cli/client.py (26528b), bili_cli/commands/__init__.py (27b), bili_cli/commands/account.py (2732b), bili_cli/commands/audio.py (4125b), bili_cli/commands/collections.py (18477b), bili_cli/commands/common.py (4818b), bili_cli/commands/discovery.py (3591b), bili_cli/commands/interactions.py (2989b), bili_cli/commands/user_search.py (7646b), bili_cli/commands/video.py (6027b), bili_cli/exceptions.py (419b), CHANGELOG.md (375b), pyproject.toml (1578b), README.md (13630b), SKILL.md (7558b), tests/conftest.py (1196b), tests/test_audio.py (7665b), tests/test_auth.py (10307b), tests/test_cli.py (34710b), tests/test_client.py (18853b), tests/test_helpers.py (2464b), tests/test_subtitle.py (1596b), _meta.json (131b)\n\nFile v0.5.0:SKILL.md\n\n---\nname: bilibili-cli\ndescription: 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\nauthor: jackwener\nversion: \"1.0.0\"\ntags:\n  - bilibili\n  - 哔哩哔哩\n  - b站\n  - video\n  - social-media\n  - cli\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Agent Defaults\n\nWhen you need machine-readable output:\n\n1. Prefer `--yaml` first because it is usually more token-efficient than pretty JSON.\n2. Use `--json` only when downstream tooling strictly requires JSON.\n3. Keep result sets small with `--max`, `--page`, or `--offset`.\n4. Prefer specific commands over broad ones. Example: use `bili user-videos 946974 --max 3 --yaml` instead of fetching large timelines.\n5. When summarizing a video, fetch subtitles first. Subtitles usually contain the video's core content and are the best primary source for summaries.\n6. Only fall back to `--ai`, comments, or audio extraction when subtitles are unavailable or clearly insufficient.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\nuv tool install bilibili-cli\n# Or: pipx install bilibili-cli\n\n# If you need audio extraction support (requires PyAV)\nuv tool install \"bilibili-cli[audio]\"\n# Or: pipx install \"bilibili-cli[audio]\"\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in (exit 0 = yes, 1 = no)\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication 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`.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle            # Show subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline   # Show subtitles with timestamps\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT format\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --yaml          # Token-efficient YAML output\nbili video BV1ABcsztEcY --json          # Raw JSON output\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --yaml\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n\n# Pagination and limit\nbili search \"关键词\" --type video --max 5\nbili search \"关键词\" --page 2\n```\n\n### Discovery\n\n```bash\nbili hot                       # Trending/popular videos\nbili hot --page 2 --max 10     # Page 2, limit 10\nbili rank                      # Site-wide ranking (3-day)\nbili rank --day 7 --max 30     # 7-day ranking, top 30\nbili feed                      # Dynamic timeline (requires login)\nbili feed --offset 1234567890  # Next page via returned cursor\nbili my-dynamics               # My posted dynamics (requires login)\nbili dynamic-post \"hello\"      # Publish text dynamic (requires write credential)\nbili dynamic-delete 123456789  # Delete one dynamic (requires write credential)\n```\n\n### Collections (require login)\n\n```bash\nbili favorites                 # List favorite folders\nbili favorites <ID> --page 2   # Videos in a folder\nbili following                 # Following list\nbili watch-later               # Watch later list\nbili history                   # Watch history\n```\n\n### Audio Extraction\n\nRequires `bilibili-cli[audio]` extra (PyAV). Install with `uv tool install \"bilibili-cli[audio]\"`.\n\n```bash\n# Download audio and split into ASR-ready WAV segments (25s each, 16kHz mono)\nbili audio BV1ABcsztEcY                 # Split to /tmp/bilibili-cli/{title}/\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a file, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n```\n\n### Interactions (require login)\n\n```bash\nbili like BV1ABcsztEcY         # Like a video\nbili like BV1ABcsztEcY --undo  # Unlike\nbili coin BV1ABcsztEcY         # Give 1 coin\nbili coin BV1ABcsztEcY -n 2    # Give 2 coins\nbili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)\nbili unfollow 946974           # Unfollow by UID\n```\n\n### Account\n\n```bash\nbili status                    # Quick login check\nbili whoami                    # Detailed profile info\nbili whoami --yaml              # Profile as YAML\nbili whoami --json              # Profile as JSON\nbili login                     # QR code login\nbili logout                    # Clear credentials\n```\n\n## Structured Output\n\nMajor query commands support both `--yaml` and `--json` for machine-readable output. Prefer YAML for agent use:\n\n```bash\nbili video BV1ABcsztEcY --yaml                       # Preferred for AI agents\nbili hot --max 5 --yaml                             # Smaller, token-efficient payload\nbili user 946974 --json | jq '.user_info.name'      # JSON when jq is needed\n```\n\n## Debugging\n\n```bash\nbili -v <command>              # Enable verbose/debug logging for any command\n```\n\n## Common Patterns for AI Agents\n\n```bash\n# For video summarization, fetch subtitles first\nbili video BV1ABcsztEcY --subtitle\n\n# Only use AI summary as a fallback or secondary signal\nbili video BV1ABcsztEcY --ai\n\n# Get comments for sentiment analysis\nbili video BV1ABcsztEcY --comments\n\n# Extract audio for speech-to-text (ASR)\n# Segments are saved to /tmp/bilibili-cli/{title}/seg_000.wav, seg_001.wav, ...\nbili audio BV1ABcsztEcY --segment 25\n\n# Find a user's latest video BV ID with minimal payload\nbili user-videos 946974 --max 1 --yaml\n\n# Check if logged in before performing actions\nbili status && bili like BV1ABcsztEcY\n\n# Search and inspect the first few results\nbili search \"topic\" --type video --max 3 --yaml\n```\n\n### Workflow: Video Content Analysis\n\n```bash\n# 1. Search for a topic\nbili search \"AI\" --type video --max 5\n\n# 2. Get subtitles first for summarization\nbili video BV1xxx --subtitle\n\n# 3. If subtitles are missing or incomplete, try AI summary\nbili video BV1xxx --ai\n\n# 4. If there is still not enough content, extract audio for ASR\nbili audio BV1xxx --segment 25\n\n# 5. Get comments for audience reaction\nbili video BV1xxx --comments\n```\n\n### Workflow: UP主 Research\n\n```bash\n# 1. Look up UP主 profile\nbili user \"影视飓风\"\n\n# 2. Get their recent videos\nbili user-videos 946974 --max 10\n\n# 3. Inspect a specific video\nbili video BV1xxx --ai --comments\n```\n\n## Error Handling\n\n- Commands exit with code 0 on success, non-zero on failure\n- Error messages are prefixed with ❌\n- Login-required commands show ⚠️ with instruction to run `bili login`\n- Invalid BV IDs show a clear error message\n\n## Safety Notes\n\n- Do not ask users to share raw credential/cookie values in chat logs.\n- Prefer local browser cookie extraction over manual secret copy/paste.\n- If auth fails, ask the user to re-login via `bili login`.\n\nFile v0.5.0:README.md\n\n# bilibili-cli\n\n[![CI](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml)\n[![PyPI version](https://img.shields.io/pypi/v/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![Python versions](https://img.shields.io/pypi/pyversions/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## More Projects\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — Xiaohongshu CLI tooling\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI tooling\n- [discord-cli](https://github.com/jackwener/discord-cli) — Discord CLI for local-first chat sync and search\n- [tg-cli](https://github.com/jackwener/tg-cli) — Telegram CLI for local-first sync, search, and export\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 🎵 **Audio** — extract audio and split into ASR-ready WAV segments\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- 🔥 **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- 📂 **Favorites** — browse favorite folders, watch-later, and watch history\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **Structured output** — major query commands support `--yaml` and `--json`\n\n## Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install bilibili-cli\n\n# Or: pipx\npipx install bilibili-cli\n\n# If you need audio extraction support\nuv tool install \"bilibili-cli[audio]\"\n# or\npipx install \"bilibili-cli[audio]\"\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\nRun tests in the project environment:\n\n```bash\nuv run pytest -q\nuv run ruff check .\nuv run mypy bili_cli\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      # With subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline        # With timeline\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT\nbili video BV1ABcsztEcY --ai            # AI summary\nbili video BV1ABcsztEcY --comments      # Top comments\nbili video BV1ABcsztEcY --related       # Related videos\nbili video BV1ABcsztEcY --yaml          # Agent-friendly YAML\nbili video BV1ABcsztEcY --json          # Raw JSON\n\n# Users\nbili user 946974                        # UP profile\nbili user \"影视飓风\"                     # Search by name\nbili user-videos 946974 --max 20        # Video list\n\n# Discovery\nbili hot                                # Trending videos (page 1)\nbili hot --page 2 --max 10              # Page 2, top 10\nbili rank                               # Site-wide ranking (3-day)\nbili rank --day 7 --max 30              # 7-day ranking, top 30\nbili search \"关键词\"                     # Search users\nbili search \"关键词\" --type video --max 5 # Search videos (top 5)\nbili search \"关键词\" --page 2            # Next page\nbili feed                               # Dynamic timeline\nbili feed --offset 1234567890           # Next page via returned cursor\nbili my-dynamics                         # My posted dynamics\nbili dynamic-post \"抽个奖，明天开奖\"       # Publish text dynamic\nbili dynamic-delete 123456789012345678   # Delete one dynamic\n\n# Collections\nbili favorites                          # Favorite folders\nbili favorites <ID> --page 2            # Videos in a folder\nbili following                          # Following list\nbili watch-later                        # Watch later\nbili history                            # Watch history\n\n# Audio extraction\nbili audio BV1ABcsztEcY                 # Download + split into 25s WAV segments\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n\n# Interactions\nbili like BV1ABcsztEcY                  # Like\nbili coin BV1ABcsztEcY                  # Give coin\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # Unfollow by UID\n```\n\n## Authentication\n\nbilibili-cli uses a 3-tier authentication strategy:\n\n1. **Saved credential** — loads from `~/.bilibili-cli/credential.json`\n2. **Browser cookies** — auto-extracts from Chrome, Firefox, Edge, or Brave\n3. **QR code login** — `bili login` displays a QR code in the terminal\n\nCredentials are validated on use for authenticated commands. Expired cookies are automatically cleared, while transient network validation failures keep local credentials for best-effort fallback.\n`bili status` exits with code `0` only when authenticated; otherwise it exits with `1`.\n\nMost commands work without login. Subtitles, favorites/following/watch-later/history, feed, my-dynamics, and interactions require authentication. Write actions (like/coin/triple/unfollow/dynamic-post/dynamic-delete) require write-capable credential (`bili_jct`).\n\nAudio extraction requires the optional `audio` dependency group (`av`).\n\n## Use as AI Agent Skill\n\nbilibili-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.\n\n### Agent Output Recommendation\n\nIf an AI agent needs machine-readable output, prefer `--yaml` first:\n\n- `--yaml` is usually more token-efficient than pretty-printed JSON\n- It is still easy to parse for agents and scripts\n- Keep `--json` for `jq`, strict JSON-only tooling, or exact downstream schemas\n\nExamples:\n\n```bash\nbili video BV1ABcsztEcY --yaml\nbili hot --max 5 --yaml\nbili user-videos 946974 --max 3 --yaml\n```\n\nFor agent usage, also prefer narrower queries (`--max`, `--page`, `--offset`) to avoid wasting context on oversized payloads.\n\nWhen an AI agent is asked to summarize a video, it should fetch subtitles first. Subtitles usually contain the core content of the video and are the best primary source for summarization. Only fall back to AI summary, comments, or audio extraction when subtitles are unavailable or insufficient.\n\n### Claude Code / Antigravity\n\n```bash\n# Clone into your project's skills directory\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# Or just copy the SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\nOnce added, AI agents that support the `.agents/skills/` convention will automatically discover and use bilibili-cli commands.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install bilibili-cli\n```\n\nAll bilibili-cli commands are available in OpenClaw after installation.\n\n---\n\n## 推荐项目\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — 小红书 CLI 工具\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI 工具\n- [discord-cli](https://github.com/jackwener/discord-cli) — Discord 本地优先同步、检索与导出 CLI\n- [tg-cli](https://github.com/jackwener/tg-cli) — Telegram 本地优先同步、检索与导出 CLI\n\n## 功能特性\n\n- 🎬 **视频** — 详情、字幕、AI 总结、评论、相关推荐\n- 🎵 **音频** — 提取视频音频，切分为语音识别 (ASR) 可用的 WAV 片段\n- 👤 **用户** — UP 主资料、视频列表、关注列表\n- 🔍 **搜索** — 按关键词搜索用户或视频\n- 🔥 **发现** — 热门视频、全站排行榜\n- 📰 **动态** — 关注的人的动态时间线\n- 📂 **收藏** — 收藏夹浏览、稍后再看、观看历史\n- 👍 **互动** — 点赞、投币、一键三连\n- 🔐 **智能认证** — 自动提取浏览器 Cookie，或扫码登录\n- 📊 **结构化输出** — 主要查询命令支持 `--yaml` 和 `--json`\n\n## 安装\n\n```bash\n# 推荐：uv tool（快速、隔离环境）\nuv tool install bilibili-cli\n\n# 或者：pipx\npipx install bilibili-cli\n\n# 如果需要音频提取功能\nuv tool install \"bilibili-cli[audio]\"\n# 或\npipx install \"bilibili-cli[audio]\"\n```\n\n或从源码安装：\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n## 使用示例\n\n```bash\n# 登录与账号\nbili status                    # 检查登录状态\nbili login                     # 扫码登录\nbili whoami                    # 查看个人信息（等级、硬币、粉丝数）\n\n# 视频\nbili video BV1ABcsztEcY                 # 视频详情\nbili video BV1ABcsztEcY --subtitle      # 显示字幕（纯文本）\nbili video BV1ABcsztEcY --subtitle-timeline        # 显示带时间线的字幕\nbili video BV1ABcsztEcY -st --subtitle-format srt  # 导出为 SRT\nbili video BV1ABcsztEcY --ai            # AI 总结\nbili video BV1ABcsztEcY --comments      # 热门评论\nbili video BV1ABcsztEcY --related       # 相关推荐\nbili video BV1ABcsztEcY --yaml          # 适合 AI Agent 的 YAML\nbili video BV1ABcsztEcY --json          # 原始 JSON\n\n# 用户\nbili user 946974                        # UP 主资料\nbili user \"影视飓风\"                     # 按用户名搜索\nbili user-videos 946974 --max 20        # 视频列表\n\n# 发现\nbili hot                                # 热门视频（第1页）\nbili hot --page 2 --max 10              # 第2页，前10条\nbili rank                               # 全站排行榜（3日）\nbili rank --day 7 --max 30              # 7日榜，前30条\nbili search \"关键词\"                     # 搜索用户\nbili search \"关键词\" --type video --max 5 # 搜索视频（前5条）\nbili search \"关键词\" --page 2            # 第2页结果\nbili feed                               # 动态时间线\nbili feed --offset 1234567890           # 使用上一页游标翻页\nbili my-dynamics                         # 我发布的动态\nbili dynamic-post \"抽个奖，明天开奖\"       # 发布文字动态\nbili dynamic-delete 123456789012345678   # 删除单条动态\n\n# 收藏\nbili favorites                          # 收藏夹列表\nbili following                          # 关注列表\nbili watch-later                        # 稍后再看\nbili history                            # 观看历史\n\n# 音频提取\nbili audio BV1ABcsztEcY                 # 下载并切分为 25 秒 WAV 片段\nbili audio BV1ABcsztEcY --segment 60    # 每段 60 秒\nbili audio BV1ABcsztEcY --no-split      # 完整 m4a，不切分\nbili audio BV1ABcsztEcY -o ~/data/      # 自定义输出目录\n\n# 互动\nbili like BV1ABcsztEcY                  # 点赞\nbili coin BV1ABcsztEcY                  # 投币\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # 取消关注（按 UID）\n```\n\n## 认证策略\n\nbilibili-cli 采用三级认证策略：\n\n1. **已保存凭证** — 从 `~/.bilibili-cli/credential.json` 加载\n2. **浏览器 Cookie** — 自动从 Chrome、Firefox、Edge、Brave 提取\n3. **扫码登录** — `bili login` 在终端显示二维码\n\n需要认证的命令会自动校验凭证。过期 Cookie 会自动清除；如果只是临时网络异常，不会误清本地凭证（会以 best-effort 继续尝试）。\n\n大部分命令无需登录。字幕、收藏夹、动态和互动操作需要登录。写操作（like/coin/triple/unfollow/dynamic-post/dynamic-delete）需要可写凭证（包含 `bili_jct`）。\n\n## AI Agent 使用建议\n\n如果 AI Agent 需要机器可读输出，默认优先 `--yaml`：\n\n- `--yaml` 通常比格式化 JSON 更省 token\n- 对 agent 来说仍然容易解析\n- 只有在要配合 `jq` 或下游必须是 JSON 时，再使用 `--json`\n\n示例：\n\n```bash\nbili video BV1ABcsztEcY --yaml\nbili hot --max 5 --yaml\nbili user-videos 946974 --max 3 --yaml\n```\n\n另外，agent 应尽量配合 `--max`、`--page`、`--offset` 缩小结果集，避免把不必要的数据带进上下文。\n\n如果 agent 要帮用户总结视频，应该优先拉字幕。字幕通常就是视频核心内容的第一手来源，最适合做 summary；只有在没有字幕或字幕明显不足时，再退回到 AI summary、评论或音频提取。\n\n音频提取功能需要安装可选依赖组 `audio`（即 `av`）。\n\n## 作为 AI Agent Skill 使用\n\nbilibili-cli 自带 [`SKILL.md`](./SKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### Claude Code / Antigravity\n\n```bash\n# 克隆到项目的 skills 目录\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# 或者只复制 SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\n添加后，支持 `.agents/skills/` 的 AI Agent 会自动发现并使用 bilibili-cli 命令。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install bilibili-cli\n```\n\n安装后即可在 OpenClaw 中直接使用所有 bilibili-cli 命令。\n\n## License\n\nApache-2.0\n\nFile v0.5.0:_meta.json\n\n{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.5.0\",\n  \"publishedAt\": 1773128046326\n}\n\nFile v0.5.0:CHANGELOG.md\n\n# Changelog\n\n## 0.5.0\n\n- Add subtitle timeline output via `bili video --subtitle-timeline` / `-st`\n- Add `--subtitle-format timeline|srt`\n- Keep subtitle timeline compatible with current `--yaml` / `--json` command surface\n- Ensure subtitle timeline requests load optional credentials like plain subtitles\n- Restore README badges and fix CI type-checking with `types-PyYAML`\n\nFile v0.5.0:pyproject.toml\n\n[project]\nname = \"bilibili-cli\"\nversion = \"0.5.0\"\ndescription = \"A CLI for Bilibili — browse videos, users, favorites from the terminal\"\nreadme = \"README.md\"\nlicense = \"Apache-2.0\"\nrequires-python = \">=3.10\"\nauthors = [{ name = \"jackwener\", email = \"jakevingoo@gmail.com\" }]\nkeywords = [\"bilibili\", \"cli\", \"terminal\", \"video\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"License :: OSI Approved :: Apache Software License\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia :: Video\",\n]\ndependencies = [\n    \"bilibili-api-python>=16.0\",\n    \"click>=8.0\",\n    \"rich>=13.0\",\n    \"aiohttp>=3.0\",\n    \"browser-cookie3>=0.19\",\n    \"pyyaml>=6.0\",\n    \"qrcode>=7.0\",\n]\n\n[project.optional-dependencies]\naudio = [\n    \"av>=14.0\",\n]\ndev = [\n    \"pytest>=8.0\",\n    \"pytest-asyncio>=0.23\",\n    \"pytest-mock>=3.0\",\n    \"ruff>=0.11.0\",\n    \"mypy>=1.15.0\",\n    \"types-PyYAML>=6.0.12\",\n    \"av>=14.0\",\n]\n\n[project.urls]\nHomepage = \"https://github.com/jackwener/bilibili-cli\"\nRepository = \"https://github.com/jackwener/bilibili-cli\"\nIssues = \"https://github.com/jackwener/bilibili-cli/issues\"\n\n[project.scripts]\nbili = \"bili_cli.cli:cli\"\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"bili_cli\"]\n\n[tool.ruff]\ntarget-version = \"py310\"\nline-length = 140\n\n[tool.ruff.lint]\nselect = [\"E\", \"F\", \"I\", \"B\", \"UP\"]\n\n[tool.mypy]\npython_version = \"3.10\"\nignore_missing_imports = true\ncheck_untyped_defs = true\nwarn_unused_ignores = true\nno_implicit_optional = true\n\nArchive v0.4.1: 24 files, 48975 bytes\n\nFiles: bili_cli/__init__.py (81b), bili_cli/auth.py (11983b), bili_cli/cli.py (2125b), bili_cli/client.py (24873b), bili_cli/commands/__init__.py (27b), bili_cli/commands/account.py (2590b), bili_cli/commands/audio.py (4125b), bili_cli/commands/collections.py (17276b), bili_cli/commands/common.py (3980b), bili_cli/commands/discovery.py (3294b), bili_cli/commands/interactions.py (2847b), bili_cli/commands/user_search.py (7232b), bili_cli/commands/video.py (5281b), bili_cli/exceptions.py (419b), pyproject.toml (1531b), README.md (10652b), SKILL.md (6463b), tests/conftest.py (1196b), tests/test_audio.py (7665b), tests/test_auth.py (10307b), tests/test_cli.py (30411b), tests/test_client.py (18853b), tests/test_helpers.py (2464b), _meta.json (131b)\n\nFile v0.4.1:SKILL.md\n\n---\nname: bilibili-cli\ndescription: CLI skill for Bilibili (哔哩哔哩, B站) to browse videos, users, search, trending, dynamics, favorites, and interactions from the terminal\nauthor: jackwener\nversion: \"1.0.0\"\ntags:\n  - bilibili\n  - 哔哩哔哩\n  - b站\n  - video\n  - social-media\n  - cli\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\nuv tool install bilibili-cli\n# Or: pipx install bilibili-cli\n\n# If you need audio extraction support (requires PyAV)\nuv tool install \"bilibili-cli[audio]\"\n# Or: pipx install \"bilibili-cli[audio]\"\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in (exit 0 = yes, 1 = no)\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication 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`.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle      # Show subtitles (AI or uploaded)\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --json          # Raw JSON output\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --json\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n\n# Pagination and limit\nbili search \"关键词\" --type video --max 5\nbili search \"关键词\" --page 2\n```\n\n### Discovery\n\n```bash\nbili hot                       # Trending/popular videos\nbili hot --page 2 --max 10     # Page 2, limit 10\nbili rank                      # Site-wide ranking (3-day)\nbili rank --day 7 --max 30     # 7-day ranking, top 30\nbili feed                      # Dynamic timeline (requires login)\nbili feed --offset 1234567890  # Next page via returned cursor\nbili my-dynamics               # My posted dynamics (requires login)\nbili dynamic-post \"hello\"      # Publish text dynamic (requires write credential)\nbili dynamic-delete 123456789  # Delete one dynamic (requires write credential)\n```\n\n### Collections (require login)\n\n```bash\nbili favorites                 # List favorite folders\nbili favorites <ID> --page 2   # Videos in a folder\nbili following                 # Following list\nbili watch-later               # Watch later list\nbili history                   # Watch history\n```\n\n### Audio Extraction\n\nRequires `bilibili-cli[audio]` extra (PyAV). Install with `uv tool install \"bilibili-cli[audio]\"`.\n\n```bash\n# Download audio and split into ASR-ready WAV segments (25s each, 16kHz mono)\nbili audio BV1ABcsztEcY                 # Split to /tmp/bilibili-cli/{title}/\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a file, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n```\n\n### Interactions (require login)\n\n```bash\nbili like BV1ABcsztEcY         # Like a video\nbili like BV1ABcsztEcY --undo  # Unlike\nbili coin BV1ABcsztEcY         # Give 1 coin\nbili coin BV1ABcsztEcY -n 2    # Give 2 coins\nbili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)\nbili unfollow 946974           # Unfollow by UID\n```\n\n### Account\n\n```bash\nbili status                    # Quick login check\nbili whoami                    # Detailed profile info\nbili whoami --json              # Profile as JSON\nbili login                     # QR code login\nbili logout                    # Clear credentials\n```\n\n## JSON Output\n\nMajor query commands support `--json` for machine-readable output:\n\n```bash\nbili video BV1ABcsztEcY --json | jq '.stat.view'    # Get view count\nbili hot --json | jq '.list[0].title'                # First trending title\nbili user 946974 --json | jq '.user_info.name'       # Username\n```\n\n## Debugging\n\n```bash\nbili -v <command>              # Enable verbose/debug logging for any command\n```\n\n## Common Patterns for AI Agents\n\n```bash\n# Get a video's subtitle text for summarization\nbili video BV1ABcsztEcY --subtitle\n\n# Get AI-generated summary of a video\nbili video BV1ABcsztEcY --ai\n\n# Get comments for sentiment analysis\nbili video BV1ABcsztEcY --comments\n\n# Extract audio for speech-to-text (ASR)\n# Segments are saved to /tmp/bilibili-cli/{title}/seg_000.wav, seg_001.wav, ...\nbili audio BV1ABcsztEcY --segment 25\n\n# Find a user's latest video BV ID\nbili user-videos 946974 --max 1 --json | python3 -c \"import sys,json; print(json.load(sys.stdin)[0]['bvid'])\"\n\n# Check if logged in before performing actions\nbili status && bili like BV1ABcsztEcY\n\n# Search and get first result\nbili search \"topic\" --type video --json | python3 -c \"import sys,json; r=json.load(sys.stdin); print(r[0]['bvid'] if r else 'not found')\"\n```\n\n### Workflow: Video Content Analysis\n\n```bash\n# 1. Search for a topic\nbili search \"AI\" --type video --max 5\n\n# 2. Get video details + subtitle\nbili video BV1xxx --subtitle\n\n# 3. If no subtitle, extract audio for ASR\nbili audio BV1xxx --segment 25\n\n# 4. Get comments for audience reaction\nbili video BV1xxx --comments\n```\n\n### Workflow: UP主 Research\n\n```bash\n# 1. Look up UP主 profile\nbili user \"影视飓风\"\n\n# 2. Get their recent videos\nbili user-videos 946974 --max 10\n\n# 3. Inspect a specific video\nbili video BV1xxx --ai --comments\n```\n\n## Error Handling\n\n- Commands exit with code 0 on success, non-zero on failure\n- Error messages are prefixed with ❌\n- Login-required commands show ⚠️ with instruction to run `bili login`\n- Invalid BV IDs show a clear error message\n\n## Safety Notes\n\n- Do not ask users to share raw credential/cookie values in chat logs.\n- Prefer local browser cookie extraction over manual secret copy/paste.\n- If auth fails, ask the user to re-login via `bili login`.\n\nFile v0.4.1:README.md\n\n# bilibili-cli\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## More Projects\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — Xiaohongshu CLI tooling\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI tooling\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 🎵 **Audio** — extract audio and split into ASR-ready WAV segments\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- 🔥 **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- 📂 **Favorites** — browse favorite folders, watch-later, and watch history\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **JSON output** — major query commands support `--json` for scripting\n\n## Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install bilibili-cli\n\n# Or: pipx\npipx install bilibili-cli\n\n# If you need audio extraction support\nuv tool install \"bilibili-cli[audio]\"\n# or\npipx install \"bilibili-cli[audio]\"\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\nRun tests in the project environment:\n\n```bash\nuv run pytest -q\nuv run ruff check .\nuv run mypy bili_cli\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      # With subtitles\nbili video BV1ABcsztEcY --ai            # AI summary\nbili video BV1ABcsztEcY --comments      # Top comments\nbili video BV1ABcsztEcY --related       # Related videos\nbili video BV1ABcsztEcY --json          # Raw JSON\n\n# Users\nbili user 946974                        # UP profile\nbili user \"影视飓风\"                     # Search by name\nbili user-videos 946974 --max 20        # Video list\n\n# Discovery\nbili hot                                # Trending videos (page 1)\nbili hot --page 2 --max 10              # Page 2, top 10\nbili rank                               # Site-wide ranking (3-day)\nbili rank --day 7 --max 30              # 7-day ranking, top 30\nbili search \"关键词\"                     # Search users\nbili search \"关键词\" --type video --max 5 # Search videos (top 5)\nbili search \"关键词\" --page 2            # Next page\nbili feed                               # Dynamic timeline\nbili feed --offset 1234567890           # Next page via returned cursor\nbili my-dynamics                         # My posted dynamics\nbili dynamic-post \"抽个奖，明天开奖\"       # Publish text dynamic\nbili dynamic-delete 123456789012345678   # Delete one dynamic\n\n# Collections\nbili favorites                          # Favorite folders\nbili favorites <ID> --page 2            # Videos in a folder\nbili following                          # Following list\nbili watch-later                        # Watch later\nbili history                            # Watch history\n\n# Audio extraction\nbili audio BV1ABcsztEcY                 # Download + split into 25s WAV segments\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n\n# Interactions\nbili like BV1ABcsztEcY                  # Like\nbili coin BV1ABcsztEcY                  # Give coin\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # Unfollow by UID\n```\n\n## Authentication\n\nbilibili-cli uses a 3-tier authentication strategy:\n\n1. **Saved credential** — loads from `~/.bilibili-cli/credential.json`\n2. **Browser cookies** — auto-extracts from Chrome, Firefox, Edge, or Brave\n3. **QR code login** — `bili login` displays a QR code in the terminal\n\nCredentials are validated on use for authenticated commands. Expired cookies are automatically cleared, while transient network validation failures keep local credentials for best-effort fallback.\n`bili status` exits with code `0` only when authenticated; otherwise it exits with `1`.\n\nMost commands work without login. Subtitles, favorites/following/watch-later/history, feed, my-dynamics, and interactions require authentication. Write actions (like/coin/triple/unfollow/dynamic-post/dynamic-delete) require write-capable credential (`bili_jct`).\n\nAudio extraction requires the optional `audio` dependency group (`av`).\n\n## Use as AI Agent Skill\n\nbilibili-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.\n\n### Claude Code / Antigravity\n\n```bash\n# Clone into your project's skills directory\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# Or just copy the SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\nOnce added, AI agents that support the `.agents/skills/` convention will automatically discover and use bilibili-cli commands.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install bilibili-cli\n```\n\nAll bilibili-cli commands are available in OpenClaw after installation.\n\n---\n\n## 推荐项目\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — 小红书 CLI 工具\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI 工具\n\n## 功能特性\n\n- 🎬 **视频** — 详情、字幕、AI 总结、评论、相关推荐\n- 🎵 **音频** — 提取视频音频，切分为语音识别 (ASR) 可用的 WAV 片段\n- 👤 **用户** — UP 主资料、视频列表、关注列表\n- 🔍 **搜索** — 按关键词搜索用户或视频\n- 🔥 **发现** — 热门视频、全站排行榜\n- 📰 **动态** — 关注的人的动态时间线\n- 📂 **收藏** — 收藏夹浏览、稍后再看、观看历史\n- 👍 **互动** — 点赞、投币、一键三连\n- 🔐 **智能认证** — 自动提取浏览器 Cookie，或扫码登录\n- 📊 **JSON 输出** — 主要查询命令支持 `--json`，方便脚本调用\n\n## 安装\n\n```bash\n# 推荐：uv tool（快速、隔离环境）\nuv tool install bilibili-cli\n\n# 或者：pipx\npipx install bilibili-cli\n\n# 如果需要音频提取功能\nuv tool install \"bilibili-cli[audio]\"\n# 或\npipx install \"bilibili-cli[audio]\"\n```\n\n或从源码安装：\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n## 使用示例\n\n```bash\n# 登录与账号\nbili status                    # 检查登录状态\nbili login                     # 扫码登录\nbili whoami                    # 查看个人信息（等级、硬币、粉丝数）\n\n# 视频\nbili video BV1ABcsztEcY                 # 视频详情\nbili video BV1ABcsztEcY --subtitle      # 显示字幕\nbili video BV1ABcsztEcY --ai            # AI 总结\nbili video BV1ABcsztEcY --comments      # 热门评论\nbili video BV1ABcsztEcY --related       # 相关推荐\n\n# 用户\nbili user 946974                        # UP 主资料\nbili user \"影视飓风\"                     # 按用户名搜索\nbili user-videos 946974 --max 20        # 视频列表\n\n# 发现\nbili hot                                # 热门视频（第1页）\nbili hot --page 2 --max 10              # 第2页，前10条\nbili rank                               # 全站排行榜（3日）\nbili rank --day 7 --max 30              # 7日榜，前30条\nbili search \"关键词\"                     # 搜索用户\nbili search \"关键词\" --type video --max 5 # 搜索视频（前5条）\nbili search \"关键词\" --page 2            # 第2页结果\nbili feed                               # 动态时间线\nbili feed --offset 1234567890           # 使用上一页游标翻页\nbili my-dynamics                         # 我发布的动态\nbili dynamic-post \"抽个奖，明天开奖\"       # 发布文字动态\nbili dynamic-delete 123456789012345678   # 删除单条动态\n\n# 收藏\nbili favorites                          # 收藏夹列表\nbili following                          # 关注列表\nbili watch-later                        # 稍后再看\nbili history                            # 观看历史\n\n# 音频提取\nbili audio BV1ABcsztEcY                 # 下载并切分为 25 秒 WAV 片段\nbili audio BV1ABcsztEcY --segment 60    # 每段 60 秒\nbili audio BV1ABcsztEcY --no-split      # 完整 m4a，不切分\nbili audio BV1ABcsztEcY -o ~/data/      # 自定义输出目录\n\n# 互动\nbili like BV1ABcsztEcY                  # 点赞\nbili coin BV1ABcsztEcY                  # 投币\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # 取消关注（按 UID）\n```\n\n## 认证策略\n\nbilibili-cli 采用三级认证策略：\n\n1. **已保存凭证** — 从 `~/.bilibili-cli/credential.json` 加载\n2. **浏览器 Cookie** — 自动从 Chrome、Firefox、Edge、Brave 提取\n3. **扫码登录** — `bili login` 在终端显示二维码\n\n需要认证的命令会自动校验凭证。过期 Cookie 会自动清除；如果只是临时网络异常，不会误清本地凭证（会以 best-effort 继续尝试）。\n\n大部分命令无需登录。字幕、收藏夹、动态和互动操作需要登录。写操作（like/coin/triple/unfollow/dynamic-post/dynamic-delete）需要可写凭证（包含 `bili_jct`）。\n\n音频提取功能需要安装可选依赖组 `audio`（即 `av`）。\n\n## 作为 AI Agent Skill 使用\n\nbilibili-cli 自带 [`SKILL.md`](./SKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### Claude Code / Antigravity\n\n```bash\n# 克隆到项目的 skills 目录\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# 或者只复制 SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\n添加后，支持 `.agents/skills/` 的 AI Agent 会自动发现并使用 bilibili-cli 命令。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install bilibili-cli\n```\n\n安装后即可在 OpenClaw 中直接使用所有 bilibili-cli 命令。\n\n## License\n\nApache-2.0\n\nFile v0.4.1:_meta.json\n\n{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.4.1\",\n  \"publishedAt\": 1772993727325\n}\n\nFile v0.4.1:pyproject.toml\n\n[project]\nname = \"bilibili-cli\"\nversion = \"0.4.1\"\ndescription = \"A CLI for Bilibili — browse videos, users, favorites from the terminal\"\nreadme = \"README.md\"\nlicense = \"Apache-2.0\"\nrequires-python = \">=3.10\"\nauthors = [{ name = \"jackwener\", email = \"jakevingoo@gmail.com\" }]\nkeywords = [\"bilibili\", \"cli\", \"terminal\", \"video\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"License :: OSI Approved :: Apache Software License\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia :: Video\",\n]\ndependencies = [\n    \"bilibili-api-python>=16.0\",\n    \"click>=8.0\",\n    \"rich>=13.0\",\n    \"aiohttp>=3.0\",\n    \"browser-cookie3>=0.19\",\n    \"qrcode>=7.0\",\n]\n\n[project.optional-dependencies]\naudio = [\n    \"av>=14.0\",\n]\ndev = [\n    \"pytest>=8.0\",\n    \"pytest-asyncio>=0.23\",\n    \"pytest-mock>=3.0\",\n    \"ruff>=0.11.0\",\n    \"mypy>=1.15.0\",\n    \"av>=14.0\",\n]\n\n[project.urls]\nHomepage = \"https://github.com/jackwener/bilibili-cli\"\nRepository = \"https://github.com/jackwener/bilibili-cli\"\nIssues = \"https://github.com/jackwener/bilibili-cli/issues\"\n\n[project.scripts]\nbili = \"bili_cli.cli:cli\"\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"bili_cli\"]\n\n[tool.ruff]\ntarget-version = \"py310\"\nline-length = 140\n\n[tool.ruff.lint]\nselect = [\"E\", \"F\", \"I\", \"B\", \"UP\"]\n\n[tool.mypy]\npython_version = \"3.10\"\nignore_missing_imports = true\ncheck_untyped_defs = true\nwarn_unused_ignores = true\nno_implicit_optional = true\n\nArchive v0.4.0: 24 files, 48363 bytes\n\nFiles: bili_cli/__init__.py (81b), bili_cli/auth.py (11983b), bili_cli/cli.py (2125b), bili_cli/client.py (24873b), bili_cli/commands/__init__.py (27b), bili_cli/commands/account.py (2590b), bili_cli/commands/audio.py (4125b), bili_cli/commands/collections.py (17276b), bili_cli/commands/common.py (3969b), bili_cli/commands/discovery.py (3294b), bili_cli/commands/interactions.py (2847b), bili_cli/commands/user_search.py (7232b), bili_cli/commands/video.py (5281b), bili_cli/exceptions.py (419b), pyproject.toml (1531b), README.md (10664b), SKILL.md (4735b), tests/conftest.py (1196b), tests/test_audio.py (7665b), tests/test_auth.py (10307b), tests/test_cli.py (30411b), tests/test_client.py (18853b), tests/test_helpers.py (2464b), _meta.json (131b)\n\nFile v0.4.0:SKILL.md\n\n---\nname: bilibili-cli\ndescription: Browse Bilibili (B站) from the terminal — videos, users, search, trending, interactions\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\npipx install bilibili-cli\n# Or: uv tool install bilibili-cli\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication auto-detects local browser cookies (Chrome/Firefox/Edge/Brave). If cookies are found and valid, no manual login needed.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle      # Show subtitles (AI or uploaded)\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --json          # Raw JSON output\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --json\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n```\n\n### Discovery\n\n```bash\nbili hot                       # Trending/popular videos\nbili hot --max 10               # Limit results\nbili rank                      # Site-wide ranking\nbili feed                      # Dynamic timeline (requires login)\nbili my-dynamics               # My posted dynamics (requires login)\nbili dynamic-post \"hello\"      # Publish text dynamic (requires write credential)\nbili dynamic-delete 123456789  # Delete one dynamic (requires write credential)\n```\n\n### Collections (require login)\n\n```bash\nbili favorites                 # List favorite folders\nbili favorites <ID> --page 2   # Videos in a folder\nbili following                 # Following list\nbili watch-later               # Watch later list\nbili history                   # Watch history\n```\n\n### Audio Extraction\n\n```bash\n# Download audio and split into ASR-ready WAV segments (25s each, 16kHz mono)\nbili audio BV1ABcsztEcY                 # Split to /tmp/bilibili-cli/{title}/\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a file, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n```\n\n### Interactions (require login)\n\n```bash\nbili like BV1ABcsztEcY         # Like a video\nbili like BV1ABcsztEcY --undo  # Unlike\nbili coin BV1ABcsztEcY         # Give 1 coin\nbili coin BV1ABcsztEcY -n 2    # Give 2 coins\nbili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)\nbili unfollow 946974           # Unfollow by UID\n```\n\n### Account\n\n```bash\nbili status                    # Quick login check\nbili whoami                    # Detailed profile info\nbili whoami --json              # Profile as JSON\nbili login                     # QR code login\nbili logout                    # Clear credentials\n```\n\n## JSON Output\n\nMajor query commands support `--json` for machine-readable output:\n\n```bash\nbili video BV1ABcsztEcY --json | jq '.stat.view'    # Get view count\nbili hot --json | jq '.list[0].title'                # First trending title\nbili user 946974 --json | jq '.user_info.name'       # Username\n```\n\n## Common Patterns for AI Agents\n\n```bash\n# Get a video's subtitle text for summarization\nbili video BV1ABcsztEcY --subtitle\n\n# Extract audio for speech-to-text (ASR)\n# Segments are saved to /tmp/bilibili-cli/{title}/seg_000.wav, seg_001.wav, ...\nbili audio BV1ABcsztEcY --segment 25\n\n# Find a user's latest video BV ID\nbili user-videos 946974 --max 1 --json | python3 -c \"import sys,json; print(json.load(sys.stdin)[0]['bvid'])\"\n\n# Check if logged in before performing actions\nbili status && bili like BV1ABcsztEcY\n\n# Search and get first result\nbili search \"topic\" --type video --json | python3 -c \"import sys,json; r=json.load(sys.stdin); print(r[0]['bvid'] if r else 'not found')\"\n```\n\n## Error Handling\n\n- Commands exit with code 0 on success, non-zero on failure\n- Error messages are prefixed with ❌\n- Login-required commands show ⚠️ with instruction to run `bili login`\n- Invalid BV IDs show a clear error message\n\nFile v0.4.0:README.md\n\n# bilibili-cli\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## More Projects\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — Xiaohongshu CLI tooling\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI tooling\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 🎵 **Audio** — extract audio and split into ASR-ready WAV segments\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- 🔥 **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- 📂 **Favorites** — browse favorite folders, watch-later, and watch history\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **JSON output** — major query commands support `--json` for scripting\n\n## Installation\n\n```bash\n# Recommended: pipx (auto-manages virtualenv)\npipx install bilibili-cli\n\n# Or: uv tool\nuv tool install bilibili-cli\n\n# If you need audio extraction support\npipx install \"bilibili-cli[audio]\"\n# or\nuv tool install \"bilibili-cli[audio]\"\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\nRun tests in the project environment:\n\n```bash\nuv run pytest -q\nuv run ruff check .\nuv run mypy bili_cli\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      # With subtitles\nbili video BV1ABcsztEcY --ai            # AI summary\nbili video BV1ABcsztEcY --comments      # Top comments\nbili video BV1ABcsztEcY --related       # Related videos\nbili video BV1ABcsztEcY --json          # Raw JSON\n\n# Users\nbili user 946974                        # UP profile\nbili user \"影视飓风\"                     # Search by name\nbili user-videos 946974 --max 20        # Video list\n\n# Discovery\nbili hot                                # Trending videos (page 1)\nbili hot --page 2 --max 10              # Page 2, top 10\nbili rank                               # Site-wide ranking (3-day)\nbili rank --day 7 --max 30              # 7-day ranking, top 30\nbili search \"关键词\"                     # Search users\nbili search \"关键词\" --type video --max 5 # Search videos (top 5)\nbili search \"关键词\" --page 2            # Next page\nbili feed                               # Dynamic timeline\nbili feed --offset 1234567890           # Next page via returned cursor\nbili my-dynamics                         # My posted dynamics\nbili dynamic-post \"抽个奖，明天开奖\"       # Publish text dynamic\nbili dynamic-delete 123456789012345678   # Delete one dynamic\n\n# Collections\nbili favorites                          # Favorite folders\nbili favorites <ID> --page 2            # Videos in a folder\nbili following                          # Following list\nbili watch-later                        # Watch later\nbili history                            # Watch history\n\n# Audio extraction\nbili audio BV1ABcsztEcY                 # Download + split into 25s WAV segments\nbili audio BV1ABcsztEcY --segment 60    # 60s per segment\nbili audio BV1ABcsztEcY --no-split      # Full m4a, no splitting\nbili audio BV1ABcsztEcY -o ~/data/      # Custom output directory\n\n# Interactions\nbili like BV1ABcsztEcY                  # Like\nbili coin BV1ABcsztEcY                  # Give coin\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # Unfollow by UID\n```\n\n## Authentication\n\nbilibili-cli uses a 3-tier authentication strategy:\n\n1. **Saved credential** — loads from `~/.bilibili-cli/credential.json`\n2. **Browser cookies** — auto-extracts from Chrome, Firefox, Edge, or Brave\n3. **QR code login** — `bili login` displays a QR code in the terminal\n\nCredentials are validated on use for authenticated commands. Expired cookies are automatically cleared, while transient network validation failures keep local credentials for best-effort fallback.\n`bili status` exits with code `0` only when authenticated; otherwise it exits with `1`.\n\nMost commands work without login. Subtitles, favorites/following/watch-later/history, feed, my-dynamics, and interactions require authentication. Write actions (like/coin/triple/unfollow/dynamic-post/dynamic-delete) require write-capable credential (`bili_jct`).\n\nAudio extraction requires the optional `audio` dependency group (`av`).\n\n## Use as AI Agent Skill\n\nbilibili-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.\n\n### Claude Code / Antigravity\n\n```bash\n# Clone into your project's skills directory\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# Or just copy the SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\nOnce added, AI agents that support the `.agents/skills/` convention will automatically discover and use bilibili-cli commands.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install bilibili-cli\n```\n\nAll bilibili-cli commands are available in OpenClaw after installation.\n\n---\n\n## 推荐项目\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — 小红书 CLI 工具\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI 工具\n\n## 功能特性\n\n- 🎬 **视频** — 详情、字幕、AI 总结、评论、相关推荐\n- 🎵 **音频** — 提取视频音频，切分为语音识别 (ASR) 可用的 WAV 片段\n- 👤 **用户** — UP 主资料、视频列表、关注列表\n- 🔍 **搜索** — 按关键词搜索用户或视频\n- 🔥 **发现** — 热门视频、全站排行榜\n- 📰 **动态** — 关注的人的动态时间线\n- 📂 **收藏** — 收藏夹浏览、稍后再看、观看历史\n- 👍 **互动** — 点赞、投币、一键三连\n- 🔐 **智能认证** — 自动提取浏览器 Cookie，或扫码登录\n- 📊 **JSON 输出** — 主要查询命令支持 `--json`，方便脚本调用\n\n## 安装\n\n```bash\n# 推荐：pipx（自动管理虚拟环境）\npipx install bilibili-cli\n\n# 或者：uv tool\nuv tool install bilibili-cli\n\n# 如果需要音频提取功能\npipx install \"bilibili-cli[audio]\"\n# 或\nuv tool install \"bilibili-cli[audio]\"\n```\n\n或从源码安装：\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n## 使用示例\n\n```bash\n# 登录与账号\nbili status                    # 检查登录状态\nbili login                     # 扫码登录\nbili whoami                    # 查看个人信息（等级、硬币、粉丝数）\n\n# 视频\nbili video BV1ABcsztEcY                 # 视频详情\nbili video BV1ABcsztEcY --subtitle      # 显示字幕\nbili video BV1ABcsztEcY --ai            # AI 总结\nbili video BV1ABcsztEcY --comments      # 热门评论\nbili video BV1ABcsztEcY --related       # 相关推荐\n\n# 用户\nbili user 946974                        # UP 主资料\nbili user \"影视飓风\"                     # 按用户名搜索\nbili user-videos 946974 --max 20        # 视频列表\n\n# 发现\nbili hot                                # 热门视频（第1页）\nbili hot --page 2 --max 10              # 第2页，前10条\nbili rank                               # 全站排行榜（3日）\nbili rank --day 7 --max 30              # 7日榜，前30条\nbili search \"关键词\"                     # 搜索用户\nbili search \"关键词\" --type video --max 5 # 搜索视频（前5条）\nbili search \"关键词\" --page 2            # 第2页结果\nbili feed                               # 动态时间线\nbili feed --offset 1234567890           # 使用上一页游标翻页\nbili my-dynamics                         # 我发布的动态\nbili dynamic-post \"抽个奖，明天开奖\"       # 发布文字动态\nbili dynamic-delete 123456789012345678   # 删除单条动态\n\n# 收藏\nbili favorites                          # 收藏夹列表\nbili following                          # 关注列表\nbili watch-later                        # 稍后再看\nbili history                            # 观看历史\n\n# 音频提取\nbili audio BV1ABcsztEcY                 # 下载并切分为 25 秒 WAV 片段\nbili audio BV1ABcsztEcY --segment 60    # 每段 60 秒\nbili audio BV1ABcsztEcY --no-split      # 完整 m4a，不切分\nbili audio BV1ABcsztEcY -o ~/data/      # 自定义输出目录\n\n# 互动\nbili like BV1ABcsztEcY                  # 点赞\nbili coin BV1ABcsztEcY                  # 投币\nbili triple BV1ABcsztEcY                # 一键三连 🎉\nbili unfollow 946974                    # 取消关注（按 UID）\n```\n\n## 认证策略\n\nbilibili-cli 采用三级认证策略：\n\n1. **已保存凭证** — 从 `~/.bilibili-cli/credential.json` 加载\n2. **浏览器 Cookie** — 自动从 Chrome、Firefox、Edge、Brave 提取\n3. **扫码登录** — `bili login` 在终端显示二维码\n\n需要认证的命令会自动校验凭证。过期 Cookie 会自动清除；如果只是临时网络异常，不会误清本地凭证（会以 best-effort 继续尝试）。\n\n大部分命令无需登录。字幕、收藏夹、动态和互动操作需要登录。写操作（like/coin/triple/unfollow/dynamic-post/dynamic-delete）需要可写凭证（包含 `bili_jct`）。\n\n音频提取功能需要安装可选依赖组 `audio`（即 `av`）。\n\n## 作为 AI Agent Skill 使用\n\nbilibili-cli 自带 [`SKILL.md`](./SKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### Claude Code / Antigravity\n\n```bash\n# 克隆到项目的 skills 目录\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# 或者只复制 SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\n添加后，支持 `.agents/skills/` 的 AI Agent 会自动发现并使用 bilibili-cli 命令。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install bilibili-cli\n```\n\n安装后即可在 OpenClaw 中直接使用所有 bilibili-cli 命令。\n\n## License\n\nApache-2.0\n\nFile v0.4.0:_meta.json\n\n{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.4.0\",\n  \"publishedAt\": 1772726953442\n}\n\nFile v0.4.0:pyproject.toml\n\n[project]\nname = \"bilibili-cli\"\nversion = \"0.4.0\"\ndescription = \"A CLI for Bilibili — browse videos, users, favorites from the terminal\"\nreadme = \"README.md\"\nlicense = \"Apache-2.0\"\nrequires-python = \">=3.10\"\nauthors = [{ name = \"jackwener\", email = \"jakevingoo@gmail.com\" }]\nkeywords = [\"bilibili\", \"cli\", \"terminal\", \"video\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"License :: OSI Approved :: Apache Software License\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia :: Video\",\n]\ndependencies = [\n    \"bilibili-api-python>=16.0\",\n    \"click>=8.0\",\n    \"rich>=13.0\",\n    \"aiohttp>=3.0\",\n    \"browser-cookie3>=0.19\",\n    \"qrcode>=7.0\",\n]\n\n[project.optional-dependencies]\naudio = [\n    \"av>=14.0\",\n]\ndev = [\n    \"pytest>=8.0\",\n    \"pytest-asyncio>=0.23\",\n    \"pytest-mock>=3.0\",\n    \"ruff>=0.11.0\",\n    \"mypy>=1.15.0\",\n    \"av>=14.0\",\n]\n\n[project.urls]\nHomepage = \"https://github.com/jackwener/bilibili-cli\"\nRepository = \"https://github.com/jackwener/bilibili-cli\"\nIssues = \"https://github.com/jackwener/bilibili-cli/issues\"\n\n[project.scripts]\nbili = \"bili_cli.cli:cli\"\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"bili_cli\"]\n\n[tool.ruff]\ntarget-version = \"py310\"\nline-length = 140\n\n[tool.ruff.lint]\nselect = [\"E\", \"F\", \"I\", \"B\", \"UP\"]\n\n[tool.mypy]\npython_version = \"3.10\"\nignore_missing_imports = true\ncheck_untyped_defs = true\nwarn_unused_ignores = true\nno_implicit_optional = true\n\nArchive v0.1.0: 14 files, 22296 bytes\n\nFiles: bili_cli/__init__.py (81b), bili_cli/auth.py (6580b), bili_cli/cli.py (28743b), bili_cli/client.py (10635b), bili_cli/exceptions.py (122b), pyproject.toml (1155b), README.md (7275b), SKILL.md (3831b), tests/conftest.py (1242b), tests/test_auth.py (2814b), tests/test_cli.py (5849b), tests/test_client.py (4517b), tests/test_helpers.py (1940b), _meta.json (131b)\n\nFile v0.1.0:SKILL.md\n\n---\nname: bilibili-cli\ndescription: Browse Bilibili (B站) from the terminal — videos, users, search, trending, interactions\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\npipx install bilibili-cli\n# Or: uv tool install bilibili-cli\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication auto-detects local browser cookies (Chrome/Firefox/Edge/Brave). If cookies are found and valid, no manual login needed.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle      # Show subtitles (AI or uploaded)\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --json          # Raw JSON output\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --json\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n```\n\n### Discovery\n\n```bash\nbili hot                       # Trending/popular videos\nbili hot --max 10               # Limit results\nbili rank                      # Site-wide ranking\nbili feed                      # Dynamic timeline (requires login)\n```\n\n### Collections (require login)\n\n```bash\nbili favorites                 # List favorite folders\nbili favorites <ID> --page 2   # Videos in a folder\nbili following                 # Following list\nbili history                   # Watch later list\n```\n\n### Interactions (require login)\n\n```bash\nbili like BV1ABcsztEcY         # Like a video\nbili like BV1ABcsztEcY --undo  # Unlike\nbili coin BV1ABcsztEcY         # Give 1 coin\nbili coin BV1ABcsztEcY -n 2    # Give 2 coins\nbili triple BV1ABcsztEcY       # 一键三连 (like + coin + favorite)\n```\n\n### Account\n\n```bash\nbili status                    # Quick login check\nbili whoami                    # Detailed profile info\nbili whoami --json              # Profile as JSON\nbili login                     # QR code login\nbili logout                    # Clear credentials\n```\n\n## JSON Output\n\nAll read commands support `--json` for machine-readable output:\n\n```bash\nbili video BV1ABcsztEcY --json | jq '.stat.view'    # Get view count\nbili hot --json | jq '.list[0].title'                # First trending title\nbili user 946974 --json | jq '.user_info.name'       # Username\n```\n\n## Common Patterns for AI Agents\n\n```bash\n# Get a video's subtitle text for summarization\nbili video BV1ABcsztEcY --subtitle\n\n# Find a user's latest video BV ID\nbili user-videos 946974 --max 1 --json | python3 -c \"import sys,json; print(json.load(sys.stdin)[0]['bvid'])\"\n\n# Check if logged in before performing actions\nbili status && bili like BV1ABcsztEcY\n\n# Search and get first result\nbili search \"topic\" --type video --json | python3 -c \"import sys,json; r=json.load(sys.stdin); print(r[0]['bvid'] if r else 'not found')\"\n```\n\n## Error Handling\n\n- Commands exit with code 0 on success, non-zero on failure\n- Error messages are prefixed with ❌\n- Login-required commands show ⚠️ with instruction to run `bili login`\n- Invalid BV IDs show a clear error message\n\nFile v0.1.0:README.md\n\n# bilibili-cli\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- � **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- �📂 **Favorites** — browse favorite folders and watch-later list\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **JSON output** — all commands support `--json` for scripting\n\n## Installation\n\n```bash\n# Recommended: pipx (auto-manages virtualenv)\npipx install bilibili-cli\n\n# Or: uv tool\nuv tool install bilibili-cli\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      # With subtitles\nbili video BV1ABcsztEcY --ai            # AI summary\nbili video BV1ABcsztEcY --comments      # Top comments\nbili video BV1ABcsztEcY --related       # Related videos\nbili video BV1ABcsztEcY --json          # Raw JSON\n\n# Users\nbili user 946974                        # UP profile\nbili user \"影视飓风\"                     # Search by name\nbili user-videos 946974 --max 20        # Video list\n\n# Discovery\nbili hot                                # Trending videos\nbili rank                               # Site-wide ranking\nbili search \"关键词\"                     # Search users\nbili search \"关键词\" --type video        # Search videos\nbili feed                               # Dynamic timeline\n\n# Collections\nbili favorites                          # Favorite folders\nbili favorites <ID> --page 2            # Videos in a folder\nbili following                          # Following list\nbili history                            # Watch later\n\n# Interactions\nbili like BV1ABcsztEcY                  # Like\nbili coin BV1ABcsztEcY                  # Give coin\nbili triple BV1ABcsztEcY                # 一键三连 🎉\n```\n\n## Authentication\n\nbilibili-cli uses a 3-tier authentication strategy:\n\n1. **Saved credential** — loads from `~/.bilibili-cli/credential.json`\n2. **Browser cookies** — auto-extracts from Chrome, Firefox, Edge, or Brave\n3. **QR code login** — `bili login` displays a QR code in the terminal\n\nCredentials are validated on each use. Expired cookies are automatically cleared.\n\nMost commands work without login. Subtitles, favorites, feed, and interactions require authentication.\n\n## Use as AI Agent Skill\n\nbilibili-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.\n\n### Claude Code / Antigravity\n\n```bash\n# Clone into your project's skills directory\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# Or just copy the SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\nOnce added, AI agents that support the `.agents/skills/` convention will automatically discover and use bilibili-cli commands.\n\n### OpenClaw / ClawHub\n\nOfficially supports [OpenClaw](https://openclaw.ai) and [ClawHub](https://docs.openclaw.ai/tools/clawhub). Install via ClawHub:\n\n```bash\nclawhub install bilibili-cli\n```\n\nAll bilibili-cli commands are available in OpenClaw after installation.\n\n---\n\n## 功能特性\n\n- 🎬 **视频** — 详情、字幕、AI 总结、评论、相关推荐\n- 👤 **用户** — UP 主资料、视频列表、关注列表\n- 🔍 **搜索** — 按关键词搜索用户或视频\n- 🔥 **发现** — 热门视频、全站排行榜\n- 📰 **动态** — 关注的人的动态时间线\n- 📂 **收藏** — 收藏夹浏览、稍后再看\n- 👍 **互动** — 点赞、投币、一键三连\n- 🔐 **智能认证** — 自动提取浏览器 Cookie，或扫码登录\n- 📊 **JSON 输出** — 所有命令支持 `--json`，方便脚本调用\n\n## 安装\n\n```bash\n# 推荐：pipx（自动管理虚拟环境）\npipx install bilibili-cli\n\n# 或者：uv tool\nuv tool install bilibili-cli\n```\n\n或从源码安装：\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\n## 使用示例\n\n```bash\n# 登录与账号\nbili status                    # 检查登录状态\nbili login                     # 扫码登录\nbili whoami                    # 查看个人信息（等级、硬币、粉丝数）\n\n# 视频\nbili video BV1ABcsztEcY                 # 视频详情\nbili video BV1ABcsztEcY --subtitle      # 显示字幕\nbili video BV1ABcsztEcY --ai            # AI 总结\nbili video BV1ABcsztEcY --comments      # 热门评论\nbili video BV1ABcsztEcY --related       # 相关推荐\n\n# 用户\nbili user 946974                        # UP 主资料\nbili user \"影视飓风\"                     # 按用户名搜索\nbili user-videos 946974 --max 20        # 视频列表\n\n# 发现\nbili hot                                # 热门视频\nbili rank                               # 全站排行榜\nbili search \"关键词\"                     # 搜索用户\nbili search \"关键词\" --type video        # 搜索视频\nbili feed                               # 动态时间线\n\n# 收藏\nbili favorites                          # 收藏夹列表\nbili following                          # 关注列表\nbili history                            # 稍后再看\n\n# 互动\nbili like BV1ABcsztEcY                  # 点赞\nbili coin BV1ABcsztEcY                  # 投币\nbili triple BV1ABcsztEcY                # 一键三连 🎉\n```\n\n## 认证策略\n\nbilibili-cli 采用三级认证策略：\n\n1. **已保存凭证** — 从 `~/.bilibili-cli/credential.json` 加载\n2. **浏览器 Cookie** — 自动从 Chrome、Firefox、Edge、Brave 提取\n3. **扫码登录** — `bili login` 在终端显示二维码\n\n凭证在每次使用时自动验证，过期 Cookie 会自动清除。\n\n大部分命令无需登录。字幕、收藏夹、动态和互动操作需要登录。\n\n## 作为 AI Agent Skill 使用\n\nbilibili-cli 自带 [`SKILL.md`](./SKILL.md)，让 AI Agent 能自动学习并使用本工具。\n\n### Claude Code / Antigravity\n\n```bash\n# 克隆到项目的 skills 目录\nmkdir -p .agents/skills\ngit clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli\n\n# 或者只复制 SKILL.md\ncurl -o .agents/skills/bilibili-cli/SKILL.md \\\n  https://raw.githubusercontent.com/jackwener/bilibili-cli/main/SKILL.md\n```\n\n添加后，支持 `.agents/skills/` 的 AI Agent 会自动发现并使用 bilibili-cli 命令。\n\n### OpenClaw / ClawHub\n\n官方支持 [OpenClaw](https://openclaw.ai) 和 [ClawHub](https://docs.openclaw.ai/tools/clawhub) 生态。通过 ClawHub 安装：\n\n```bash\nclawhub install bilibili-cli\n```\n\n安装后即可在 OpenClaw 中直接使用所有 bilibili-cli 命令。\n\n## License\n\nApache-2.0\n\nFile v0.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.1.0\",\n  \"publishedAt\": 1772626115760\n}\n\nFile v0.1.0:pyproject.toml\n\n[project]\nname = \"bilibili-cli\"\nversion = \"0.1.0\"\ndescription = \"A CLI for Bilibili — browse videos, users, favorites from the terminal\"\nreadme = \"README.md\"\nlicense = \"Apache-2.0\"\nrequires-python = \">=3.10\"\nauthors = [{ name = \"jackwener\", email = \"jakevingoo@gmail.com\" }]\nkeywords = [\"bilibili\", \"cli\", \"terminal\", \"video\"]\nclassifiers = [\n    \"Development Status :: 3 - Alpha\",\n    \"Environment :: Console\",\n    \"License :: OSI Approved :: Apache Software License\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia :: Video\",\n]\ndependencies = [\n    \"bilibili-api-python>=16.0\",\n    \"click>=8.0\",\n    \"rich>=13.0\",\n    \"aiohttp>=3.0\",\n    \"browser-cookie3>=0.19\",\n]\n\n[project.optional-dependencies]\ndev = [\"pytest>=8.0\", \"pytest-asyncio>=0.23\", \"pytest-mock>=3.0\"]\n\n[project.urls]\nHomepage = \"https://github.com/jackwener/bilibili-cli\"\nRepository = \"https://github.com/jackwener/bilibili-cli\"\nIssues = \"https://github.com/jackwener/bilibili-cli/issues\"\n\n[project.scripts]\nbili = \"bili_cli.cli:cli\"\n\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n\n[tool.hatch.build.targets.wheel]\npackages = [\"bili_cli\"]","readmeExcerpt":"Skill: bilibili-cli Owner: jackwener Summary: CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact... Tags: latest:0.6.0 Version history: v0.6.0 | 2026-03-10T16:30:53.890Z | user Release 0.6.0 v0.5.0 | 2026-03-10T07:34:06.326Z | user Release 0.5.0 v0.4.1 | 2026-03-08T18:15:27.325Z | user Sync SKILL.md: add Chinese","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"# Install (requires Python 3.10+)\nuv tool install bilibili-cli\n# Or: pipx install bilibili-cli\n\n# If you need audio extraction support (requires PyAV)\nuv tool install \"bilibili-cli[audio]\"\n# Or: pipx install \"bilibili-cli[audio]\""},{"language":"bash","snippet":"bili status                    # Check if logged in (exit 0 = yes, 1 = no)\nbili login                     # QR code login (if not authenticated)"},{"language":"bash","snippet":"# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle            # Show subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline   # Show subtitles with timestamps\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT format\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --yaml          # Token-efficient YAML output\nbili video BV1ABcsztEcY --json          # Structured JSON envelope"},{"language":"bash","snippet":"# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --yaml"},{"language":"bash","snippet":"# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n\n# Pagination and limit\nbili search \"关键词\" --type video --max 5\nbili search \"关键词\" --page 2"},{"language":"bash","snippet":"bili hot                       # Trending/popular videos\nbili hot --page 2 --max 10     # Page 2, limit 10\nbili rank                      # Site-wide ranking (3-day)\nbili rank --day 7 --max 30     # 7-day ranking, top 30\nbili feed                      # Dynamic timeline (requires login)\nbili feed --offset 1234567890  # Next page via returned cursor\nbili my-dynamics               # My posted dynamics (requires login)\nbili dynamic-post \"hello\"      # Publish text dynamic (requires write credential)\nbili dynamic-delete 123456789  # Delete one dynamic (requires write credential)"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: bilibili-cli\ndescription: 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\nauthor: jackwener\nversion: \"1.0.0\"\ntags:\n  - bilibili\n  - 哔哩哔哩\n  - b站\n  - video\n  - social-media\n  - cli\n---\n\n# bilibili-cli Skill\n\nA 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.\n\n## Agent Defaults\n\nWhen you need machine-readable output:\n\n1. Prefer `--yaml` first because it is usually more token-efficient than pretty JSON.\n2. Use `--json` only when downstream tooling strictly requires JSON.\n3. Keep result sets small with `--max`, `--page`, or `--offset`.\n4. Prefer specific commands over broad ones. Example: use `bili user-videos 946974 --max 3 --yaml` instead of fetching large timelines.\n5. When summarizing a video, fetch subtitles first. Subtitles usually contain the video's core content and are the best primary source for summaries.\n6. Only fall back to `--ai`, comments, or audio extraction when subtitles are unavailable or clearly insufficient.\n\n## Prerequisites\n\n```bash\n# Install (requires Python 3.10+)\nuv tool install bilibili-cli\n# Or: pipx install bilibili-cli\n\n# If you need audio extraction support (requires PyAV)\nuv tool install \"bilibili-cli[audio]\"\n# Or: pipx install \"bilibili-cli[audio]\"\n```\n\n## Authentication\n\nMost read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.\n\n```bash\nbili status                    # Check if logged in (exit 0 = yes, 1 = no)\nbili login                     # QR code login (if not authenticated)\n```\n\nAuthentication 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`.\n\n## Command Reference\n\n### Video\n\n```bash\n# Get video details (accepts BV ID or full URL)\nbili video BV1ABcsztEcY\nbili video https://www.bilibili.com/video/BV1ABcsztEcY\n\n# Options\nbili video BV1ABcsztEcY --subtitle            # Show subtitles (plain text)\nbili video BV1ABcsztEcY --subtitle-timeline   # Show subtitles with timestamps\nbili video BV1ABcsztEcY -st --subtitle-format srt  # Export as SRT format\nbili video BV1ABcsztEcY --ai            # Show B站 AI summary\nbili video BV1ABcsztEcY --comments      # Show top comments\nbili video BV1ABcsztEcY --related       # Show related videos\nbili video BV1ABcsztEcY --yaml          # Token-efficient YAML output\nbili video BV1ABcsztEcY --json          # Structured JSON envelope\n```\n\n### User\n\n```bash\n# Look up user profile (by UID or username)\nbili user 946974\nbili user \"影视飓风\"\n\n# List user's videos\nbili user-videos 946974 --max 20\nbili user-videos \"影视飓风\" --yaml\n```\n\n### Search\n\n```bash\n# Search users (default)\nbili search \"关键词\"\n\n# Search videos\nbili search \"关键词\" --type video\n\n# "},{"path":"README.md","content":"# bilibili-cli\n\n[![CI](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jackwener/bilibili-cli/actions/workflows/ci.yml)\n[![PyPI version](https://img.shields.io/pypi/v/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![Python versions](https://img.shields.io/pypi/pyversions/bilibili_cli.svg)](https://pypi.org/project/bilibili-cli/)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)\n\nA CLI for Bilibili — browse videos, users, favorites from the terminal 📺\n\n[English](#features) | [中文](#功能特性)\n\n## More Projects\n\n- [xhs-cli](https://github.com/jackwener/xhs-cli) — Xiaohongshu CLI tooling\n- [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI tooling\n- [discord-cli](https://github.com/jackwener/discord-cli) — Discord CLI for local-first chat sync and search\n- [tg-cli](https://github.com/jackwener/tg-cli) — Telegram CLI for local-first sync, search, and export\n\n## Features\n\n- 🎬 **Video** — details, subtitles, AI summary, comments, related videos\n- 🎵 **Audio** — extract audio and split into ASR-ready WAV segments\n- 👤 **User** — profile, video list, following list\n- 🔍 **Search** — search users or videos by keyword\n- 🔥 **Trending** — hot videos and site-wide ranking\n- 📰 **Feed** — dynamic timeline from your follows\n- 📂 **Favorites** — browse favorite folders, watch-later, and watch history\n- 👍 **Interactions** — like, coin, triple (一键三连)\n- 🔐 **Smart auth** — auto-extracts cookies from Chrome/Firefox, or QR code login\n- 📊 **Structured output** — major query commands support `--yaml` and `--json`\n- 🤖 **Agent-friendly defaults** — non-TTY stdout defaults to YAML; override with `OUTPUT=yaml|json|rich|auto`\n- 📦 **Stable envelope** — see [SCHEMA.md](./SCHEMA.md) for `ok/schema_version/data/error`\n- 🧱 **Normalized payloads** — command-layer output is normalized instead of leaking raw upstream SDK responses\n\n## Installation\n\n```bash\n# Recommended: uv tool (fast, isolated)\nuv tool install bilibili-cli\n\n# Or: pipx\npipx install bilibili-cli\n\n# If you need audio extraction support\nuv tool install \"bilibili-cli[audio]\"\n# or\npipx install \"bilibili-cli[audio]\"\n```\n\nOr from source:\n\n```bash\ngit clone git@github.com:jackwener/bilibili-cli.git\ncd bilibili-cli\nuv sync\n```\n\nRun tests in the project environment:\n\n```bash\nuv sync --extra dev\nuv run pytest -q\nuv run ruff check .\nuv run python -m mypy bili_cli\n```\n\nIf the project directory was moved and stale virtualenv wrappers remain, rerun:\n\n```bash\nuv sync --extra dev --reinstall\n```\n\n## Usage\n\n```bash\n# Login & account\nbili status                    # Check login status\nbili status --yaml             # Structured auth status\nbili login                     # QR code login\nbili whoami                    # Detailed profile (level, coins, followers)\nbili whoami --yaml             # Structured profile\n\n# Videos\nbili video BV1ABcsztEcY                 # Video details\nbili video BV1ABcsztEcY --subtitle      "},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn757vsv03fbpevrxybjc424wh828377\",\n  \"slug\": \"bilibili-cli\",\n  \"version\": \"0.6.0\",\n  \"publishedAt\": 1773160253890\n}"},{"path":"CHANGELOG.md","content":"# Changelog\n\n## 0.5.0\n\n- Add subtitle timeline output via `bili video --subtitle-timeline` / `-st`\n- Add `--subtitle-format timeline|srt`\n- Keep subtitle timeline compatible with current `--yaml` / `--json` command surface\n- Ensure subtitle timeline requests load optional credentials like plain subtitles\n- Restore README badges and fix CI type-checking with `types-PyYAML`"},{"path":"SCHEMA.md","content":"# Structured Output Schema\n\n`bilibili-cli` uses a shared agent-friendly envelope for machine-readable output.\n\n## Success\n\n```yaml\nok: true\nschema_version: \"1\"\ndata: ...\n```\n\n## Error\n\n```yaml\nok: false\nschema_version: \"1\"\nerror:\n  code: api_error\n  message: 未找到用户: foo\n```\n\n## Notes\n\n- `--yaml` and `--json` both use this envelope\n- non-TTY stdout defaults to YAML\n- command payloads are normalized at the CLI layer\n- list-like results are typically returned under `data.items`\n- `status` returns `data.authenticated` plus `data.user`\n- `whoami` returns `data.user` and `data.relation`\n- `video` returns `data.video`, `data.subtitle`, `data.ai_summary`, `data.comments`, `data.related`, and `data.warnings`\n- write commands return normalized action payloads with `data.success` and `data.action`\n\n## Error Codes\n\nCommon structured error codes:\n\n- `not_authenticated`\n- `permission_denied`\n- `invalid_input`\n- `network_error`\n- `upstream_error`\n- `not_found`\n- `internal_error`"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact... Skill: bilibili-cli Owner: jackwener Summary: CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interact... Tags: latest:0.6.0 Version history: v0.6.0 | 2026-03-10T16:30:53.890Z | user Release 0.6.0 v0.5.0 | 2026-03-10T07:34:06.326Z | user Release 0.5.0 v0.4.1 | 2026-03-08T18:15:27.325Z | user Sync SKILL.md: add Chinese","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":906,"uniquenessScore":55,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T11:10:07.606Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T14:13:40.345Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}