agents365-ai/365-skills

bbc-skill

Fetch Bilibili (哔哩哔哩) video comments for UP主 self-analysis.

查看源码
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

bbc-skill — Bilibili Comment Collector

Download all comments (top-level + nested + pinned) for a Bilibili video and produce data that Claude Code can analyze downstream.

Update check

Throttle to one check per 24 hours per installation; never mutate the skill directory without explicit user consent.

  1. If <this-skill-dir>/.last_update exists and is less than 24 hours old, skip this step entirely.
  1. Otherwise, fetch the latest tag from upstream:
bash
   git -C <this-skill-dir> ls-remote --tags origin 'v*' 2>/dev/null \
     | awk '{print $2}' | sed 's|refs/tags/||' \
     | sort -V | tail -1
  1. Compare with this skill's metadata.version from the frontmatter. If the upstream tag is strictly newer (semver), tell the user one line and ask:
"A newer version of this skill is available: vX.Y.Z → vA.B.C. Want me to git pull?"

If they say yes, run git -C <this-skill-dir> pull --ff-only. Refresh .last_update either way so the prompt doesn't repeat for 24 hours.

  1. If upstream is the same or older, refresh .last_update silently and continue.
  1. On any failure (offline, not a git checkout — e.g. ClawHub-installed copy, read-only path, no permission), swallow the error silently and continue with the user's task. Do not mention the failure.

When to use

Trigger this skill when the user:

  • Asks to get / fetch / download / export / collect / analyze comments of a

specific Bilibili video (BV 号, URL, or video page).

  • Asks to analyze **audience feedback / sentiment / keywords / top comments /

IP distribution** of their own Bilibili videos.

  • Provides a Bilibili URL like https://www.bilibili.com/video/BVxxxxxxxxxx/.
  • Mentions their UP主 UID and wants batch analysis across their videos.

Do not use for: posting / deleting comments, downloading videos, barrage (弹幕), live stream data, or private messages.

Prerequisites

  1. Python 3.9+ (stdlib only — zero pip install).
  2. Bilibili cookie. The user must be logged in to bilibili.com. The

recommended path:

  • Install the Chrome/Edge extension

**Get cookies.txt LOCALLY** (open-source, fully local, no upload).

  • On a logged-in bilibili.com tab, click Export → save

www.bilibili.com_cookies.txt.

  • Pass via --cookie-file or set $BBC_COOKIE_FILE.

Alternatives:

  • $BBC_SESSDATA env var with just the SESSDATA value.
  • Browser auto-detection (Firefox / Chrome / Edge on macOS) via

--browser auto. Works best for Firefox; Chrome/Edge needs a logged-in profile with cookies flushed to disk.

Auth delegation (Principle 7): the skill never runs OAuth flows. The human is expected to log in via browser; the agent only consumes the resulting cookie.

Quick start

Before any fetch, verify the cookie works:

bash
python3 -m bbc cookie-check

Success envelope (stdout):

json
{"ok":true,"data":{"mid":441831884,"uname":"探索未至之境","vip":false}}

Fetch all comments for a single video:

bash
python3 -m bbc fetch BV1NjA7zjEAU

Or pass a URL:

bash
python3 -m bbc fetch "https://www.bilibili.com/video/BV1NjA7zjEAU/"

Output (default ./bilibili-comments/<BV>/):

  • comments.jsonl — one comment per line, flattened
  • summary.json — video metadata + statistics + top-N
  • raw/ — archived API responses
  • .bbc-state.json — resume state

Commands

CommandPurpose
`bbc fetch <BV\URL>`Fetch all comments for one video
bbc fetch-user <UID>Batch fetch all videos of a UP主
bbc summarize <dir>Rebuild summary.json from existing comments.jsonl
bbc cookie-checkValidate cookie; print logged-in user
bbc schema [cmd]Return JSON schema for commands (for agent discovery)

Call bbc <cmd> --help or bbc schema <cmd> for full parameter details — do not guess flag names.

Agent contract

Stdout vs stderr

  • stdout: stable JSON envelope {"ok":true,"data":...} or

{"ok":false,"error":...}. JSON is the default when stdout is not a TTY. Pass --format table for human-readable tables.

  • stderr: human log lines + NDJSON progress events for long tasks.

Exit codes

CodeMeaning
0Success
1Runtime / API error
2Auth error (cookie invalid / missing)
3Validation error (bad BV number, bad flag)
4Network error (timeout / retries exhausted)

Error envelope

json
{
  "ok": false,
  "error": {
    "code": "auth_expired",
    "message": "SESSDATA 已过期,请重新登录 B 站",
    "retryable": true,
    "retry_after_auth": true
  }
}

Error codes: validation_error, auth_required, auth_expired, not_found, rate_limited, api_error, network_error. See bbc schema for the full contract.

Dry-run

Every fetch command supports --dry-run to preview the planned request without making network calls:

bash
python3 -m bbc fetch BV1NjA7zjEAU --dry-run

Idempotency

Re-running the same fetch command on the same output directory resumes from .bbc-state.json (skips already-fetched pages). Pass --force to refetch.

Analysis workflow (for the agent)

After fetch completes:

  1. Read `summary.json` first (< 10 KB) to establish global context: video

metadata, total counts, time distribution, top-N.

  1. For thematic analysis, Grep or head/tail on comments.jsonl

each line is a flat JSON object, never load the whole file unless small.

  1. Typical analyses:
  • Sentiment distribution → scan message by batch
  • Top fans → group by mid, count entries, aggregate like
  • UP 主互动 → filter is_up_reply=true
  • Audience geography → ip_location histogram
  • Feedback timeline → bucket ctime_iso by day/week

The summary.json schema is documented in references/agent-contract.md. Run the skill against any video to produce a real sample locally.

Safety tier

All commands are read-only (tier: open). No mutation, no deletion, no message sending. Dry-run available for all fetch commands.

References

  • references/api-endpoints.md — Bilibili API fields used
  • references/cookie-extraction.md — per-browser cookie decryption
  • references/agent-contract.md — full envelope + schema contract

Limitations

  • all_count returned by the API includes pinned comments. Completeness

check: top_level + nested + pinned == declared_all_count.

  • Very old comments (>2 years) may return thin data if the user was deleted.
  • Anti-bot: aggressive --max values or repeated runs may trigger HTTP 412.

The client sleeps 1s between requests and backs off on 412.

来自同一仓库

更多 Skills

全部 Skills
agents365-ai
社区

drawio-skill

Create, edit, synchronize, inspect, test, and publish editable draw.io diagrams. Use when the user explicitly requests draw.io/diagrams.net, needs a polished architecture, ERD, UML, sequence, C4, SysML, BPMN, network, swimlane, ML, or infrastructure diagram, wants code/IaC/SQL/OpenAPI/AsyncAPI/Protobuf converted into a diagram, or wants an existing diagram queried, reviewed, diffed, restyled, kept in sync, or made interactive. Prefer Mermaid/PlantUML elsewhere when the requested artifact is diagrams-as-code rather than an editable draw.io file.

安装量
9
GitHub Stars
48
最近更新
9月11日
agents365-ai
社区

agent-native-design

Use when designing, reviewing, or refactoring a CLI that must serve AI agents alongside humans, or when converting an API or SDK into an agent-usable CLI interface.

安装量
3
GitHub Stars
48
最近更新
9月11日
agents365-ai
社区

assetseeker

Search free commercial-use creative assets across multiple online sources — photos, illustrations, icons, video footage, music, sound effects, and fonts. Use when the user needs to find assets for videos, PPTs, articles, or any content creation. Trigger on phrases like "find me a photo of", "search for icons", "I need background music", "find video footage", "search fonts", "找一张图片", "搜素材", "帮我找图标/视频/音乐/字体". Covers Pexels, Unsplash, Pixabay, Iconify, Freesound, Google Fonts and more — with API-backed search where available.

安装量
3
GitHub Stars
48
最近更新
9月11日
agents365-ai
社区

asta-skill

Domain expertise for Ai2 Asta MCP tools (Semantic Scholar corpus). Intent-to-tool routing, safe defaults, workflow patterns, and pitfall warnings for academic paper search, citation traversal, and author discovery.

安装量
3
GitHub Stars
48
最近更新
9月11日