bilibili-deep-profile-collect
采集B站当前登录用户的全量个人信息,包括基础资料、投稿视频、收藏夹内容、关注列表
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
采集B站当前登录用户的全量个人信息,包括基础资料、投稿视频、收藏夹内容、关注列表
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Collect user data from logged-in social platforms (Douyin, Xiaohongshu, Weibo, Douban, Bilibili), cross-analyze to build a precise personal profile, and auto-generate USER.md + MEMORY.md. Use for new user onboarding, personalization, and building user context. 通过用户已登录的社交平台自动采集数据并交叉分析,生成精准用户画像,写入 USER.md 和 MEMORY.md。
采集小红书个人主页的全量信息,包括基础资料、全部发布笔记(含详情正文和标签)、收藏笔记列表(全量)、点赞笔记列表(全量)
采集豆瓣当前登录用户的全量个人信息,包括基础资料、看过/想看的电影、读过/想读的书、广播动态
深度采集抖音个人主页信息,包含基础资料、全部作品(含播放数)、喜欢列表、收藏列表、全量关注列表
采集微博个人主页的全量信息,包括基础资料($CONFIG.user)、全部微博、关注列表、收藏列表
| name | bilibili-deep-profile-collect |
| description | 采集B站当前登录用户的全量个人信息,包括基础资料、投稿视频、收藏夹内容、关注列表 |
| version | 2.0.0 |
本 Skill 用于采集B站当前登录用户的个人主页全量信息。通过 /x/web-interface/nav API 获取用户基础信息,结合 DOM 提取和 API 分页采集全量数据。
采集内容:
核心技术:
/x/web-interface/nav API —— 获取登录用户信息/x/v3/fav/folder/created/list-all + /x/v3/fav/resource/list API —— 收藏夹采集.bili-video-card DOM 提取 —— 投稿视频(API 需 wbi 签名,无法直接 fetch).relation-card-info__uname + .vui_pagenation DOM 翻页 —— 关注列表(API 返回 -101)⚠️ 执行约束:本 Skill 中的所有 JS 脚本都必须完整复制执行,不可自行简化、改写或省略任何部分。每个脚本都经过实际测试验证,简化会导致数据不完整。
使用 bilibili-deep-profile-collect 采集我的B站个人主页信息
无需提供参数,自动检测当前登录用户。
无。本 Skill 自动通过 nav API 检测当前登录用户。
前提条件:浏览器已登录B站账号。
工具:chrome_navigate
参数:
url: https://www.bilibili.com工具:chrome_execute_script
参数:
world: MAINtimeout: 10000jsScript:async () => {
try {
const resp = await fetch(
'https://api.bilibili.com/x/web-interface/nav',
{credentials: 'include'}
);
const data = await resp.json();
if (data.code === 0 && data.data) {
const d = data.data;
return JSON.stringify({
mid: d.mid, uname: d.uname, face: d.face,
level: d.level_info?.current_level,
coins: d.money, moral: d.moral,
vipType: d.vipType, vipStatus: d.vipStatus,
isLogin: d.isLogin
});
}
return JSON.stringify({error: 'not logged in', code: data.code});
} catch(e) { return JSON.stringify({error: e.message}); }
}
说明:/x/web-interface/nav 是B站最可靠的用户信息 API,返回完整的登录用户数据。
输出:mid(后续步骤使用 {step_2.mid} 构建 URL)、uname、level、face
工具:chrome_navigate
参数:
url: https://space.bilibili.com/{step_2.mid}/video工具:chrome_execute_script
参数:
world: MAINtimeout: 15000jsScript:() => {
const videos = [];
const seen = new Set();
document.querySelectorAll('.bili-video-card').forEach(card => {
const titleLink = card.querySelector(
'.bili-video-card__title a, a[href*="BV"]'
);
if (!titleLink) return;
const title = titleLink.textContent.trim();
const href = titleLink.getAttribute('href') || '';
const bvMatch = href.match(/BV\w+/);
const bvid = bvMatch ? bvMatch[0] : '';
if (title && bvid && !seen.has(bvid)) {
seen.add(bvid);
videos.push({title, bvid, href});
}
});
return JSON.stringify({total: videos.length, videos: videos});
}
说明:从 DOM 提取投稿视频列表。
/x/space/wbi/arc/search 需要 wbi 签名,直接 fetch 返回 -403.bili-video-card.bili-video-card__title a(包含 BV 号)工具:chrome_execute_script
参数:
world: MAINtimeout: 15000jsScript:async () => {
const mid = '{step_2.mid}';
const resp = await fetch(
'https://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid=' + mid,
{credentials: 'include'}
);
const data = await resp.json();
if (data.code !== 0 || !data.data?.list)
return JSON.stringify({error: data.message});
const folders = data.data.list.map(f => ({
id: f.id, title: f.title, mediaCount: f.media_count
}));
return JSON.stringify({count: folders.length, folders: folders});
}
说明:获取所有收藏夹的 id、名称、视频数量。
输出:folders 列表(步骤6遍历使用)
工具:chrome_execute_script
参数:
world: MAINtimeout: 180000jsScript:async () => {
const folders = {step_5.folders};
const allFavs = {};
const MAX_PER_FOLDER = 100; // 每个收藏夹最多100条
for (const folder of folders) {
const items = [];
let pn = 1;
while (items.length < MAX_PER_FOLDER) {
try {
const resp = await fetch(
'https://api.bilibili.com/x/v3/fav/resource/list?media_id='
+ folder.id + '&pn=' + pn + '&ps=20&order=mtime&platform=web',
{credentials: 'include'}
);
const data = await resp.json();
if (data.code !== 0 || !data.data?.medias) break;
data.data.medias.forEach(m => {
items.push({
title: m.title,
bvid: m.bvid || m.bv_id,
upper: m.upper?.name || '',
fav_time: m.fav_time
});
});
if (!data.data.has_more) break;
pn++;
await new Promise(r => setTimeout(r, 800));
} catch(e) { break; }
}
const sampled = items.length >= MAX_PER_FOLDER;
allFavs[folder.id] = {title: folder.title, total: items.length, items: items.slice(0, MAX_PER_FOLDER), sampled};
}
return JSON.stringify(allFavs);
}
说明:遍历每个收藏夹,通过 /x/v3/fav/resource/list API 分页采集。
ps=20)has_more=false 时终止工具:chrome_navigate
参数:
url: https://space.bilibili.com/{step_2.mid}/fans/follow工具:chrome_execute_script
参数:
world: MAINtimeout: 300000jsScript:async () => {
await new Promise(r => setTimeout(r, 3000));
const MAX_USERS = 500; // 上限500人
const allUsers = [];
const seen = new Set();
const selfMid = '{step_2.mid}';
let pageNum = 0;
while (pageNum < 100 && allUsers.length < MAX_USERS) {
// 提取当前页用户
document.querySelectorAll('a.relation-card-info__uname').forEach(a => {
const href = a.getAttribute('href') || '';
const m = href.match(/(\d+)/);
if (!m) return;
const userMid = m[1];
if (userMid === selfMid || seen.has(userMid)) return;
const name = a.textContent.trim();
if (name.length > 0 && name.length < 30) {
seen.add(userMid);
allUsers.push({name, mid: userMid});
}
});
// 点击下一页
const nextBtn = document.querySelector(
'.vui_pagenation--btn-side:last-child'
);
if (!nextBtn || nextBtn.classList.contains('vui_button--disabled')) break;
nextBtn.click();
await new Promise(r => setTimeout(r, 2000));
pageNum++;
}
const sampled = allUsers.length >= MAX_USERS;
return JSON.stringify({count: allUsers.length, pages: pageNum + 1, users: allUsers.slice(0, MAX_USERS), sampled});
}
说明:通过 DOM 翻页采集关注列表全量数据。关键选择器:
a.relation-card-info__uname.vui_pagenation--btn-side:last-child.vui_button--disabled/x/relation/followings 通过 fetch 返回 -101(未登录),cookie 不传递工具:chrome_close_tabs
| API | 可用性 | 说明 |
|---|---|---|
/x/web-interface/nav | ✅ fetch 可用 | 用户基础信息 |
/x/v3/fav/folder/created/list-all | ✅ fetch 可用 | 收藏夹列表 |
/x/v3/fav/resource/list | ✅ fetch 可用 | 收藏夹内容 |
/x/space/wbi/arc/search | ❌ 需要 wbi 签名 | 投稿视频,改用 DOM |
/x/relation/followings | ❌ fetch 返回 -101 | 关注列表,改用 DOM 翻页 |
本 Skill 混合使用 API 和 DOM 两种方式:
问题1:nav API 返回 code ≠ 0
问题2:投稿视频为0但实际有视频
.bili-video-card 选择器可能因页面改版失效问题3:关注列表翻页中断
.bili-video-card DOM + .relation-card-info__uname 翻页,取代旧选择器