Logo Bilibili Hub

Bilibili Hub

Tổ chức
OpenMinis
bilibili-hub

A skill for reading and writing Bilibili data with Python + UV, using bilibili-api-python + aiohttp. It automatically obtains cookies through `browser_use get_cookies` for authentication, so no manual copying is required. Supports video details, subtitles, AI summaries, comments, user profiles, search, popular videos/rankings, following dynamics feed, favorites, Watch Later, viewing history, interactions (likes, coins, triple action), publishing and deleting dynamics, and more. When a user mentions "Bilibili," "bilibili," "Bilibili videos," "Bilibili popular," "bilibili-hub," "get Bilibili data," "Bilibili subtitles," "Bilibili comments," "Bilibili favorites," "Bilibili dynamics," or any scenario that requires programmatically reading or writing Bilibili content, this skill must be triggered.

Tổng quan

Nhà phát hànhOpenMinis
Kho mãMinisSkills
Tên kỹ năngbilibili-hub
Sao
543
Bản fork
86
Tệp đi kèm
5
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được OpenMinis công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Bilibili Hub trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/OpenMinis/MinisSkills/tree/main/bilibili-hub
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OpenMinis/MinisSkills.git /tmp/MinisSkills
mkdir -p .claude/skills
cp -r /tmp/MinisSkills/bilibili-hub .claude/skills/bilibili-hub
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Bilibili Hub trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Bilibili Hub ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Bilibili Hub với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

bilibili-hub

Modified from: jackwener/bilibili-cli (Apache-2.0)

This skill simplifies and modifies the original repository as follows:

  • Removed the browser-cookie3 / click / rich / PyYAML / qrcode dependencies
  • Changed cookie authentication to accept a dict directly or read from environment variables, without automatic browser extraction
  • Removed the CLI layer (commands/), QR login, formatters, and related components
  • Kept all API methods and wrapped them uniformly as synchronous interfaces (asyncio.run)
  • Core dependency: bilibili-api-python, a third-party SDK that reverse engineers the Bilibili API
  • In the Minis environment, cookies are obtained automatically through browser_use get_cookies

File Structure

/var/minis/skills/bilibili-hub/
├── SKILL.md
├── pyproject.toml          # bilibili-api-python + aiohttp
└── scripts/
    ├── __init__.py
    ├── exceptions.py       # 6 structured exception types
    ├── payloads.py         # Data structure normalization (normalize_* functions)
    └── client.py           # BiliClient core class (all API methods)

Authentication Methods

The Bilibili Web API uses three key cookies:

CookieDescription
SESSDATAUser session (required for read operations)
bili_jctCSRF token (required for write operations: likes, coins, posting dynamics, etc.)
DedeUserIDUser ID (recommended)
buvid3Device ID (recommended; reduces the likelihood of triggering risk control)

Method 1: Automatically retrieve via browser_use (preferred in Minis environments)

  1. Use browser_use navigate to open https://www.bilibili.com and confirm that you are logged in.
  2. Use browser_use get_cookies to retrieve cookies (raw values do not appear in the conversation).
  3. Load the offload env file:
bash
. /var/minis/offloads/env_cookies_www_bilibili_com_xxx.sh
export BILI_SESSDATA="$COOKIE_SESSDATA"
export BILI_JCT="$COOKIE_BILI_JCT"
export BILI_USERID="$COOKIE_DEDEUSERID"
export BILI_BUVID3="$COOKIE_BUVID3"

Note: get_cookies only applies to the current page's domain. Navigate to https://www.bilibili.com before calling it.

Method 2: Manually retrieve from browser DevTools

  1. Log in to Bilibili, then open DevTools -> Application -> Cookies -> https://www.bilibili.com.
  2. Find the values of SESSDATA, bili_jct, and DedeUserID.
  3. Store them in the Minis environment variables: BILI_SESSDATA / BILI_JCT / BILI_USERID.

Ways to pass cookies (three methods)

python
# Method 1: From environment variables (recommended)
client = BiliClient.from_env()

# Method 2: Pass a dict directly
client = BiliClient({
    "SESSDATA":   os.environ["BILI_SESSDATA"],
    "bili_jct":   os.environ["BILI_JCT"],
    "DedeUserID": os.environ["BILI_USERID"],
})

# Method 3: Read-only operations (no write permissions required)
client = BiliClient({"SESSDATA": os.environ["BILI_SESSDATA"]})

Quick Start

Environment setup

bash
cd /var/minis/skills/bilibili-hub
uv sync

Calling as a Python library

python
import os, json, sys
sys.path.insert(0, "/var/minis/skills/bilibili-hub")
from scripts.client import BiliClient

client = BiliClient.from_env()

# Current user information
me = client.whoami()
print("User:", me.get("name"), "UID:", me.get("mid"))

# Search videos
videos = client.search_videos("Python Tutorial", count=5)
for v in videos:
    print(f"  {v['bvid']} {v['title']} ({v['duration']})")

# Get video details (including subtitles)
detail = client.get_video("BV1xx411c7mD", subtitle=True)
print(detail["video"]["title"])
print(detail["subtitle"]["text"][:200])

# Popular videos
hot = client.get_hot(count=10)
for v in hot:
    print(f"  {v['bvid']} {v['title']} 👁{v['stats']['view']}")

API Method Quick Reference

Account

MethodDescription
whoami()Get information about the currently logged-in user

Video

MethodDescription
get_video(bvid, *, subtitle, subtitle_timeline, ai_summary, comments, related)Get video details (optional subtitles/AI summary/comments/related videos)

bvid supports a BV number or full URL and is extracted automatically.

Users

MethodDescription
get_user(uid)Get user profile information + following/follower counts
get_user_videos(uid, count=20)Get videos posted by a user

Search

MethodDescription
search_videos(keyword, page=1, count=20)Search videos
search_users(keyword, page=1)Search users

Discover

MethodDescription
get_hot(page=1, count=20)Site-wide popular videos
get_rank(day=3, count=50)Site-wide rankings (day: 1/3/7)
get_feed(offset=0)Following dynamics feed (login required)
get_my_dynamics(offset=0)Dynamics I published (login required)
post_dynamic(text)Post a text dynamic (login + bili_jct required)
delete_dynamic(dynamic_id)Delete a dynamic (login + bili_jct required)

Favorites / History

MethodDescription
get_favorites()Get the favorites folder list (login required)
get_favorites(folder_id)Get videos in a favorites folder
get_following(page=1)Get the following list (login required)
get_watch_later()Get the Watch Later list (login required)
get_history()Get viewing history (login required)

Download

MethodDescription
download_video(bvid, output_dir, filename=None)Download the full video (mp4), automatically handling DASH merging
download_audio(bvid, output_dir, filename=None)Download only the audio stream (m4a), suitable for ASR transcription

Download process:

  • DASH streams (common): download the video stream and audio stream separately -> merge with ffmpeg copy -> if merging fails, keep the silent video
  • FLV/MP4 streams (rare): download directly, no merging required
  • Without logging in, downloads are limited to 480P; after logging in, 1080P is available (premium members can download higher quality)
MethodDescription
like(bvid) / like(bvid, undo=True)Like / unlike (requires bili_jct)
coin(bvid, num=1)Give 1 or 2 coins (requires bili_jct)
triple(bvid)Perform the one-click triple action (requires bili_jct)
unfollow(uid)Unfollow a user (requires bili_jct)

Error Handling

python
from scripts.exceptions import (
    AuthenticationError,  # Cookie missing or expired
    RateLimitError,       # Triggered risk control (412)
    NotFoundError,        # Video/user does not exist
    NetworkError,         # Network/timeout error
    InvalidBvidError,     # Invalid BV number format
    BiliError,            # Other API error (base class)
)

try:
    detail = client.get_video("BV1xx411c7mD")
except AuthenticationError:
    print("Cookie has expired. Please retrieve it again.")
except RateLimitError:
    print("Risk control triggered. Try again later.")
except NotFoundError:
    print("Video does not exist.")
except BiliError as e:
    print(f"API error: {e}")

Important Notes

  • SESSDATA is the minimum requirement for read operations. Write operations (likes, coins, posting dynamics) also require bili_jct.
  • Cookies are usually valid for several days to several weeks. After they expire, retrieve them again through browser_use get_cookies.
  • Bilibili applies risk control to high-frequency requests (HTTP 412). An operation interval of at least 1 second is recommended.
  • bilibili-api-python is a community-maintained reverse-engineering project, and its interfaces may break when Bilibili updates.
  • Write operations (coins, triple action, etc.) cannot be reversed. Use them with caution.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Bilibili Hub làm được gì?

A skill for reading and writing Bilibili data with Python + UV, using bilibili-api-python + aiohttp. It automatically obtains cookies through `browser_use get_cookies` for authentication, so no manual copying is required. Supports video details, subtitles, AI summaries, comments, user profiles, search, popular videos/rankings, following dynamics feed, favorites, Watch Later, viewing history, interactions (likes, coins, triple action), publishing and deleting dynamics, and more. When a user mentions "Bilibili," "bilibili," "Bilibili videos," "Bilibili popular," "bilibili-hub," "get Bilibili...

Vì sao nên dùng Bilibili Hub trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Bilibili Hub là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Bilibili Hub trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/OpenMinis/MinisSkills/tree/main/bilibili-hub. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Bilibili Hub?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Bilibili Hub với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Bilibili Hub với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Bilibili Hub có miễn phí không?

Có. Kỹ năng này được OpenMinis phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇