文件内容
skill.json
{
"name": "bilibili-all-in-one",
"description": "A comprehensive Bilibili toolkit that integrates hot trending monitoring, video downloading, video watching/playback, subtitle downloading, and video publishing capabilities into a single skill.",
"version": "1.0.24",
"author": "wscats",
"license": "MIT",
"homepage": "https://github.com/wscats/bilibili-all-in-one",
"repository": "https://github.com/wscats/bilibili-all-in-one",
"source": "https://github.com/wscats/bilibili-all-in-one",
"type": "code",
"runtime": "python>=3.8",
"entry_point": "main.py",
"required_env_vars": [],
"optional_env_vars": ["BILIBILI_SESSDATA", "BILIBILI_BILI_JCT", "BILIBILI_BUVID3", "BILIBILI_PERSIST"],
"install": {
"type": "pip",
"command": "pip install -r requirements.txt",
"packages": [
"httpx==0.27.2",
"aiohttp==3.10.11",
"beautifulsoup4==4.12.3",
"lxml==5.3.0",
"requests==2.32.3"
],
"source": "pypi",
"install_recommendation": "Install inside an isolated virtualenv (e.g. python -m venv .venv) to avoid polluting the host site-packages. All dependency versions are pinned exactly."
},
"env_vars": [
{
"name": "BILIBILI_SESSDATA",
"type": "string",
"description": "Bilibili SESSDATA cookie for authenticated API access. Only required for publishing and high-quality (1080p+/4K) downloads. Most features work without this.",
"required": false,
"sensitive": true
},
{
"name": "BILIBILI_BILI_JCT",
"type": "string",
"description": "Bilibili bili_jct cookie (CSRF token) for write operations (upload, edit). Only required for publishing. Most features work without this.",
"required": false,
"sensitive": true
},
{
"name": "BILIBILI_BUVID3",
"type": "string",
"description": "Bilibili buvid3 cookie for device identification in authenticated sessions.",
"required": false,
"sensitive": true
},
{
"name": "BILIBILI_PERSIST",
"type": "string",
"description": "Set to '1', 'true', or 'yes' to enable automatic credential persistence. When enabled, credentials are saved to .credentials.json (0600 permissions) and auto-loaded on next startup. Default: disabled (in-memory only).",
"required": false,
"sensitive": false
}
],
"credentials": {
"primary_credential": "BILIBILI_SESSDATA",
"credential_type": "bilibili_session_cookies",
"credential_required_for": "Only the Publisher module (upload/edit/schedule/draft) and high-quality downloads (1080p+/4K) require credentials. All other features (hot monitoring, standard downloads, subtitles, danmaku, stats) work WITHOUT any credentials.",
"scope_limitations": {
"outbound_destinations": ["api.bilibili.com", "member.bilibili.com", "upos-sz-upcdnbda2.bilivideo.com", "www.bilibili.com"],
"functional_scope": ["video metadata read", "video file upload", "video publish / edit / schedule / draft", "logged-in high-quality playback URLs"],
"never_sent_to_third_parties": true,
"no_password_required": "The skill never asks for your Bilibili username or password. Only session cookies (which you can revoke at any time from bilibili.com) are accepted.",
"revocation": "Log out from bilibili.com or clear cookies to invalidate the credential at any time."
},
"credential_scope_warning": "These are Bilibili session cookies. Although the skill only uses them against official Bilibili endpoints listed in `scope_limitations.outbound_destinations`, the cookies themselves — if they leak outside this process — could be replayed against Bilibili by other software. Use a test/throwaway account and rotate cookies after use.",
"storage": "in-memory by default. Set persist=True (or env BILIBILI_PERSIST=1) to auto-save/load credentials from .credentials.json with 0600 permissions. The file is ignored if older than 30 days, refused if the containing directory is group/world-writable, and can be removed via auth.clear_persisted().",
"security_notes": [
"Credentials are NOT persisted to disk by default. Persistence must be explicitly opted-in via persist=True or BILIBILI_PERSIST=1.",
"When persisted, the credential file is written with mode 0600, refused in unsafe directories, and auto-expires after 30 days.",
"Prefer passing credentials via environment variables or in-memory parameters.",
"All API requests go to official Bilibili endpoints over HTTPS.",
"Use a test/throwaway Bilibili account for evaluation purposes.",
"Session cookies can be revoked any time by logging out of bilibili.com or clearing browser cookies."
]
},
"network": {
"protocol": "HTTPS only",
"allowed_domains": [
"api.bilibili.com",
"member.bilibili.com",
"upos-sz-upcdnbda2.bilivideo.com",
"www.bilibili.com"
],
"third_party_telemetry": false,
"analytics": false
},
"files": [
"main.py",
"requirements.txt",
"skill.json",
"skill.md",
"LICENSE",
"README.md",
"src/__init__.py",
"src/auth.py",
"src/utils.py",
"src/hot_monitor.py",
"src/downloader.py",
"src/player.py",
"src/subtitle.py",
"src/watcher.py",
"src/publisher.py"
],
"skills": [
{
"name": "bilibili_hot_monitor",
"description": "Monitor Bilibili hot/trending videos and topics in real-time. Supports filtering by category, tracking rank changes, and sending notifications.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["get_hot", "get_trending", "get_weekly", "get_rank"],
"description": "The action to perform: get_hot (hot videos), get_trending (trending topics), get_weekly (weekly must-watch), get_rank (category rankings)"
},
"category": {
"type": "string",
"description": "Category filter (e.g., 'all', 'anime', 'music', 'dance', 'game', 'tech', 'life', 'food', 'car', 'fashion', 'entertainment', 'movie', 'tv')",
"default": "all"
},
"limit": {
"type": "integer",
"description": "Maximum number of results to return",
"default": 20
}
},
"required": ["action"]
}
},
{
"name": "bilibili_downloader",
"description": "Download Bilibili videos with support for multiple quality options, batch downloading, and format selection.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["download", "get_info", "get_formats", "batch_download"],
"description": "The action to perform: download (download a video), get_info (get video info), get_formats (list available formats), batch_download (download multiple videos)"
},
"url": {
"type": "string",
"description": "Bilibili video URL or BV number (e.g., 'https://www.bilibili.com/video/BV1xx411c7mD' or 'BV1xx411c7mD')"
},
"urls": {
"type": "array",
"items": { "type": "string" },
"description": "List of Bilibili video URLs for batch download"
},
"quality": {
"type": "string",
"enum": ["360p", "480p", "720p", "1080p", "1080p+", "4k"],
"description": "Video quality to download",
"default": "1080p"
},
"output_dir": {
"type": "string",
"description": "Output directory for downloaded files",
"default": "./downloads"
},
"format": {
"type": "string",
"enum": ["mp4", "flv", "mp3"],
"description": "Output format",
"default": "mp4"
}
},
"required": ["action"]
}
},
{
"name": "bilibili_watcher",
"description": "Watch and monitor Bilibili videos. Track view counts, comments, likes, and other engagement metrics over time.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["watch", "get_stats", "track", "compare"],
"description": "The action to perform: watch (get video details), get_stats (get engagement stats), track (track video metrics over time), compare (compare multiple videos)"
},
"url": {
"type": "string",
"description": "Video URL (supports Bilibili)"
},
"urls": {
"type": "array",
"items": { "type": "string" },
"description": "List of video URLs for comparison"
},
"interval": {
"type": "integer",
"description": "Tracking interval in minutes (for track action)",
"default": 60
},
"duration": {
"type": "integer",
"description": "Tracking duration in hours (for track action)",
"default": 24
}
},
"required": ["action"]
}
},
{
"name": "bilibili_subtitle",
"description": "Download and process subtitles/CC from Bilibili videos. Supports multiple subtitle formats and languages.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["download", "list", "convert", "merge"],
"description": "The action to perform: download (download subtitles), list (list available subtitles), convert (convert subtitle format), merge (merge multiple subtitle files)"
},
"url": {
"type": "string",
"description": "Bilibili video URL or BV number"
},
"language": {
"type": "string",
"description": "Subtitle language preference (e.g., 'zh-CN', 'en', 'ja')",
"default": "zh-CN"
},
"format": {
"type": "string",
"enum": ["srt", "ass", "vtt", "txt", "json"],
"description": "Output subtitle format",
"default": "srt"
},
"output_dir": {
"type": "string",
"description": "Output directory for subtitle files",
"default": "./subtitles"
}
},
"required": ["action"]
}
},
{
"name": "bilibili_player",
"description": "Play Bilibili videos with support for playback control, playlist management, and danmaku (bullet comments) display.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["play", "get_playurl", "get_danmaku", "get_playlist"],
"description": "The action to perform: play (play a video), get_playurl (get direct play URL), get_danmaku (get danmaku/bullet comments), get_playlist (get playlist info)"
},
"url": {
"type": "string",
"description": "Bilibili video URL or BV number"
},
"quality": {
"type": "string",
"enum": ["360p", "480p", "720p", "1080p", "1080p+", "4k"],
"description": "Playback quality",
"default": "1080p"
},
"danmaku": {
"type": "boolean",
"description": "Whether to include danmaku (bullet comments)",
"default": true
},
"page": {
"type": "integer",
"description": "Page/episode number for multi-part videos",
"default": 1
}
},
"required": ["action"]
}
},
{
"name": "bilibili_publisher",
"description": "Publish videos to Bilibili. Supports uploading videos, setting metadata, scheduling publications, and managing drafts. All destructive actions (upload/draft/schedule/edit) default to dry-run mode and require explicit dry_run=false AND confirm=true before any change is sent to Bilibili.",
"safety": {
"destructive": true,
"requires_explicit_confirmation": true,
"confirmation_parameters": ["dry_run", "confirm"],
"default_mode": "dry_run preview — no mutation is performed unless the caller passes dry_run=false AND confirm=true"
},
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["upload", "draft", "schedule", "edit"],
"description": "The action to perform: upload (upload and publish), draft (save as draft), schedule (schedule publication), edit (edit existing video)"
},
"file_path": {
"type": "string",
"description": "Path to the video file to upload"
},
"title": {
"type": "string",
"description": "Video title"
},
"description": {
"type": "string",
"description": "Video description"
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "Video tags"
},
"category": {
"type": "string",
"description": "Video category (tid)"
},
"cover_path": {
"type": "string",
"description": "Path to cover image"
},
"schedule_time": {
"type": "string",
"description": "Scheduled publish time (ISO 8601 format, for schedule action)"
},
"bvid": {
"type": "string",
"description": "BV number of existing video (for edit action)"
},
"dry_run": {
"type": "boolean",
"description": "If true (default), return a preview of what would be published but do NOT call the Bilibili API. Required to be set to false (together with confirm=true) to actually mutate the user's Bilibili account.",
"default": true
},
"confirm": {
"type": "boolean",
"description": "Must be set to true (together with dry_run=false) to authorize the destructive publish/edit action. Safety guardrail against agents invoking publish without explicit user approval.",
"default": false
},
"credential": {
"type": "object",
"description": "Bilibili login credential (sessdata, bili_jct, buvid3)"
}
},
"required": ["action"]
}
}
],
"configuration": {
"bilibili_sessdata": {
"type": "string",
"description": "Bilibili SESSDATA cookie. Optional — only needed for publishing and 1080p+/4K downloads. Most features work without credentials.",
"required": false,
"sensitive": true
},
"bilibili_bili_jct": {
"type": "string",
"description": "Bilibili bili_jct cookie (CSRF token). Optional — only needed for publishing (upload/edit). Most features work without credentials.",
"required": false,
"sensitive": true
},
"bilibili_buvid3": {
"type": "string",
"description": "Bilibili buvid3 cookie for device identification. Optional.",
"required": false,
"sensitive": true
},
"default_quality": {
"type": "string",
"description": "Default video quality",
"default": "1080p"
},
"default_output_dir": {
"type": "string",
"description": "Default output directory",
"default": "./output"
}
},
"permissions": {
"network": {
"description": "HTTP/HTTPS requests to Bilibili official APIs",
"allowed_domains": [
"api.bilibili.com",
"member.bilibili.com",
"www.bilibili.com",
"upos-sz-upcdnbda2.bilivideo.com"
]
},
"filesystem": {
"description": "Read/write access for downloading videos, subtitles, and uploading files",
"operations": ["read_local_files", "write_downloads", "write_subtitles"],
"note": "Credential files are NEVER auto-created. save_to_file() must be explicitly called by the user."
},
"subprocess": {
"description": "The skill spawns exactly ONE external process: the `ffmpeg` binary, and only to mux a locally-downloaded video-only stream with a locally-downloaded audio-only stream into a single output file.",
"invocations": [
{
"binary": "ffmpeg",
"location": "src/downloader.py :: BilibiliDownloader._merge_streams",
"argv_shape": ["ffmpeg", "-y", "-nostdin", "-loglevel", "error", "-i", "<local_video_tmp>", "-i", "<local_audio_tmp>", "-c", "copy", "<local_output_path>"],
"argument_sources": "All three path arguments are produced by this process from `sanitize_filename(video.title)` + `sanitize_filename(pages[i].part)` + constant suffixes `.video.tmp` / `.audio.tmp`. No user-supplied string, URL, cookie, remote API response, or shell metacharacter ever reaches the argv.",
"shell": false,
"uses_shell_true": false,
"uses_os_system": false,
"uses_os_popen": false,
"binary_resolution": "Absolute path resolved once via `shutil.which('ffmpeg')` — no PATH lookup at execve() time.",
"environment": "Minimal — only PATH is forwarded; HOME / LD_* / credential-bearing env vars are stripped.",
"io": "stdin=/dev/null, stdout=/dev/null, stderr=/dev/null",
"timeout_seconds": 1800,
"purpose": "Audio/video stream muxing (DASH -> single MP4). This is standard, expected ffmpeg usage, not arbitrary code execution."
}
],
"no_other_subprocesses": "The entire codebase contains NO other calls to subprocess.*, os.system, os.popen, eval, exec, or shell=True. This is enforced by grep audit on every release."
}
},
"always": false,
"activation_note": "This skill should only be activated when the user explicitly requests Bilibili-related operations. It does NOT auto-activate on keyword/link detection.",
"disable_model_invocation": false
}