Bilibili Garb (B站个性装扮)
Collect and manage Bilibili personalization items: garb suits, digital card collections, and benefit sub-items.
Setup
All authentication credentials are read from environment variables or a config file. Create configs/bili-api-creds.json in your workspace:
{
"appkey": "27eb53fc9058f8c3",
"appsecret": "<obtain from Bilibili mobile client>",
"access_key": "<your access_key>",
"csrf": "<your bili_jct>",
"DedeUserID": "<your uid>",
"SESSDATA": "<your SESSDATA>"
}
Or export environment variables:
export BILI_SESSDATA="<your SESSDATA>"
export BILI_ACCESS_KEY="<your access_key>"
export BILI_CSRF="<your bili_jct>"
export BILI_UID="<your uid>"
How to obtain credentials: Capture from Bilibili mobile app HTTP traffic (e.g., mitmproxy, Charles). The
access_keyexpires periodically and must be refreshed.
Commands
Search Garb Items
bash scripts/bilibili-garb-search.sh "关键词"
Searches both the official API and a local gallery database. Outputs Markdown with:
- Collection items (收藏集) with
biz_id - Suit items (套装) with
item_id - Discontinued items from local gallery marked
[藏馆-绝版]
Query Collection/Suit Details
bash scripts/bilibili-garb-collection.sh -i <ID>
- ID ≤ 6 digits → collection (收藏集) mode
- ID > 6 digits → suit (套装) mode
- Falls back to local gallery database for discontinued items
Scan Benefit Data
python3 scripts/garb-benefit-scan.py [options]
Scans owned garb items from data/decorations-database.json, calls benefit API for each, and appends results to data/garb-benefit-results.ndjson.
Options:
--limit N— process only N items--dry-run— show what would be scanned without making API calls--force— rescan items that already have benefit data--debug— output full API responses
Supports resume (Ctrl+C safe) and deduplication.
Key API Knowledge
See references/bilibili-garb-api-reference.md for full API documentation.
Critical points:
- Benefit API (
/x/garb/v2/user/suit/benefit) is the only way to get data for discontinued items. Requires sign authentication. - DIY suits: When
item_idcontains a hyphen (e.g.,1775103232001-0), passbiz_idas theitem_idparameter instead — the originalitem_idreturns-400. partparameter: Only one call withpart=space_bgreturns all 9 sub-item types. No need to iterate.- Scarcity tiers: Use
item_listAPI'sscarcityfield as the primary source. Whenscarcity_rate=2andrate2_count==1, default to small-hidden (30), do not auto-upgrade to large-hidden. - DLC avatar frames: Must come from
lottery_home_detail, never from collection's ownframe/frame_image.
Standard Operating Procedure
See references/bilibili-garb-sop.md for step-by-step workflows.