UNPKG

rsshub

Version:
38 lines (36 loc) 1.4 kB
import { t as config } from "./config-C37vj7VH.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as config_not_found_default } from "./config-not-found-Dyp3RlZZ.mjs"; //#region lib/routes/mihoyo/bbs/cache.ts const getUserFullInfo = (ctx, uid) => { if (!uid && !config.mihoyo.cookie) throw new config_not_found_default("GetUserFullInfo is not available due to the absense of [Miyoushe Cookie]. Check <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config tutorial</a>"); uid ||= ""; const key = "mihoyo:user-full-info-uid-" + uid; return cache_default.tryGet(key, async () => { const userInfo = (await got_default({ method: "get", url: `https://bbs-api.miyoushe.com/user/wapi/getUserFullInfo?${new URLSearchParams({ uid, gids: 2 }).toString()}`, headers: { Referer: `https://www.miyoushe.com/ys/accountCenter/postList?id=${uid}`, Cookie: config.mihoyo.cookie } }))?.data?.data?.user_info; if (!userInfo) throw new Error("未获取到数据!"); const { nickname, introduce, gender, certification, avatar_url, uid: userId } = userInfo; return { nickname, introduce, gender, certification, avatar_url, uid: userId }; }); }; var cache_default$1 = { getUserFullInfo }; //#endregion export { cache_default$1 as t };