bilibili/me
bilibiliRead-onlyGet current Bilibili logged-in user info
www.bilibili.com
Last 7 days
0
Last 30 days
0
All time
0
bilibili/me.js
/* @meta
{
"name": "bilibili/me",
"description": "Get current Bilibili logged-in user info",
"domain": "www.bilibili.com",
"args": {},
"capabilities": ["network"],
"readOnly": true,
"example": "tap site bilibili/me"
}
*/
async function(args) {
const resp = await fetch('https://api.bilibili.com/x/web-interface/nav', {credentials: 'include'});
if (!resp.ok) return {error: 'HTTP ' + resp.status, hint: 'Not logged in?'};
const d = await resp.json();
if (d.code !== 0) return {error: d.message || 'API error ' + d.code, hint: 'Not logged in?'};
if (!d.data?.isLogin) return {error: 'Not logged in', hint: 'Please log in to bilibili.com first'};
const u = d.data;
const result = {
mid: u.mid,
username: u.uname,
url: 'https://space.bilibili.com/' + u.mid,
face: u.face,
level: u.level_info?.current_level,
coins: u.money,
vip: u.vipType > 0,
vip_type: u.vipType === 1 ? 'monthly' : u.vipType === 2 ? 'annual' : 'none',
vip_label: u.vip_label?.text || null,
moral: u.moral,
email_verified: u.email_verified === 1,
tel_verified: u.mobile_verified === 1,
follower: null,
following: null
};
try {
const statResp = await fetch('https://api.bilibili.com/x/web-interface/nav/stat', {credentials: 'include'});
const statData = await statResp.json();
if (statData.code === 0 && statData.data) {
result.follower = statData.data.follower;
result.following = statData.data.following;
}
} catch(e) {}
return result;
}
Updated Mar 31, 2026Created Mar 31, 2026SHA-256: 5678bdc2c37e…