diff --git a/pugongying/xhs-pgy-export.user.js b/pugongying/xhs-pgy-export.user.js index 0d0806b..5d7db97 100644 --- a/pugongying/xhs-pgy-export.user.js +++ b/pugongying/xhs-pgy-export.user.js @@ -16,6 +16,7 @@ })(typeof globalThis !== "undefined" ? globalThis : this, function factory(root) { const API_BASE = "https://pgy.xiaohongshu.com/api/solar/cooperator/user/blogger/"; + const PROXY_API_BASE = "https://api.internal.intelligrow.cn"; const SUPPLEMENTAL_ENDPOINTS = [ { namespace: "fansProfile", @@ -24,12 +25,37 @@ userId, )}/fans_profile`, }, + { + namespace: "dataSummary", + buildUrl: (userId) => + `${PROXY_API_BASE}/v1/pugongying/data_summary?userId=${encodeURIComponent(userId)}`, + extraHeaders: () => ({ "X-Cookie": root.document.cookie }), + }, + { + namespace: "fansSummary", + buildUrl: (userId) => + `${PROXY_API_BASE}/v1/pugongying/fans_summary?userId=${encodeURIComponent(userId)}`, + extraHeaders: () => ({ "X-Cookie": root.document.cookie }), + }, ]; const NAMESPACE_LABEL_MAP = { fansProfile: "粉丝画像", + dataSummary: "数据概览", + fansSummary: "粉丝概览", }; const FIELD_LABEL_MAP = { id: "ID", + dataSummary: "数据概览", + "dataSummary.mCpuvNum": "外溢进店中位数", + "dataSummary.estimatePictureCpm": "预估CPM(图文)", + "dataSummary.estimateVideoCpm": "预估CPM(视频)", + "dataSummary.picReadCost": "预估阅读单价(图文)", + "dataSummary.videoReadCost": "预估阅读单价(视频)", + "dataSummary.fans30GrowthRate": "粉丝量变化幅度", + fansSummary: "粉丝概览", + "fansSummary.activeFansRate": "活跃粉丝占比(%)", + "fansSummary.readFansRate": "阅读粉丝占比(%)", + "fansSummary.engageFansRate": "互动粉丝占比(%)", fansProfile: "粉丝画像", "fansProfile.ages.<18": "18岁以下粉丝占比", "fansProfile.ages.18-24": "18-24岁粉丝占比", @@ -62,11 +88,19 @@ const FIELD_GROUPS = [ { label: "达人信息", - fields: SELECTABLE_FIELD_PATHS.filter((p) => !p.startsWith("fansProfile.")), + fields: SELECTABLE_FIELD_PATHS.filter( + (p) => !p.startsWith("fansProfile.") && !p.startsWith("dataSummary.") && !p.startsWith("fansSummary."), + ), + }, + { + label: "数据概览", + fields: SELECTABLE_FIELD_PATHS.filter((p) => p.startsWith("dataSummary.")), }, { label: "粉丝画像", - fields: SELECTABLE_FIELD_PATHS.filter((p) => p.startsWith("fansProfile.")), + fields: SELECTABLE_FIELD_PATHS.filter( + (p) => p.startsWith("fansProfile.") || p.startsWith("fansSummary."), + ), }, ]; const STORAGE_INPUT_KEY = "xhs-pgy-export:last-input"; @@ -353,11 +387,14 @@ } async function fetchSupplementalPayload(userId, fetchImpl, config) { + const extra = + typeof config.extraHeaders === "function" ? config.extraHeaders() : {}; const response = await fetchImpl(config.buildUrl(userId), { method: "GET", credentials: "include", headers: { accept: "application/json, text/plain, */*", + ...extra, }, });