修复缺失字段
This commit is contained in:
parent
e494f32b14
commit
c0a531fd1d
@ -51,7 +51,7 @@
|
||||
{
|
||||
namespace: "dataSummary",
|
||||
buildUrl: (userId) =>
|
||||
`${PROXY_API_BASE}/v1/pugongying/data_summary?userId=${encodeURIComponent(userId)}`,
|
||||
`${PROXY_API_BASE}/v1/pugongying/data_summary?userId=${encodeURIComponent(userId)}&business=1`,
|
||||
extraHeaders: () => ({
|
||||
"X-Cookie": root.document.cookie,
|
||||
"Authorization": "Bearer PsjpalaBZF2EVIyU5M7V9KHzUstOIN82LyMn9nqLekExyxIBnjjURlMKMDBSZwrG",
|
||||
@ -80,7 +80,10 @@
|
||||
"dataSummary.estimateVideoCpm": "预估CPM(视频)",
|
||||
"dataSummary.picReadCost": "预估阅读单价(图文)",
|
||||
"dataSummary.videoReadCost": "预估阅读单价(视频)",
|
||||
"dataSummary.fans30GrowthRate": "粉丝量变化幅度",
|
||||
"dataSummary.fans30GrowthRate": "粉丝量变化幅度(%)",
|
||||
"dataSummary.mAccumImpNum": "曝光中位数",
|
||||
"dataSummary.mEngagementNum": "互动中位数",
|
||||
"dataSummary.readMedian": "阅读中位数",
|
||||
fansSummary: "粉丝概览",
|
||||
"fansSummary.activeFansRate": "活跃粉丝占比(%)",
|
||||
"fansSummary.readFansRate": "阅读粉丝占比(%)",
|
||||
@ -107,9 +110,6 @@
|
||||
lowerPrice: "最低报价",
|
||||
userType: "用户类型",
|
||||
tradeType: "合作行业",
|
||||
clickMidNum: "阅读中位数",
|
||||
accumCoopImpMedinNum30d: "近30天合作曝光中位数",
|
||||
mEngagementNum: "互动中位数",
|
||||
};
|
||||
const SELECTABLE_FIELD_PATHS = Object.keys(FIELD_LABEL_MAP).filter(
|
||||
(path) => !(path in NAMESPACE_LABEL_MAP),
|
||||
|
||||
40
pugongying/xhs-pgy-export.user.test.js
Normal file
40
pugongying/xhs-pgy-export.user.test.js
Normal file
@ -0,0 +1,40 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
// The userscript exports some helpers in a shorthand object; in Node that means any
|
||||
// undeclared identifiers referenced there must exist on `global`.
|
||||
global.buildSpreadsheetXml = () => "";
|
||||
global.document = { cookie: "x=y" };
|
||||
|
||||
const api = require("./xhs-pgy-export.user.js");
|
||||
|
||||
function okJson(payload) {
|
||||
return {
|
||||
ok: true,
|
||||
status: 200,
|
||||
async json() {
|
||||
return payload;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
test("data_summary request includes business=1", async () => {
|
||||
const urls = [];
|
||||
|
||||
async function fetchImpl(url) {
|
||||
urls.push(url);
|
||||
if (String(url).startsWith(api.API_BASE)) {
|
||||
return okJson({ data: { userId: "u-123" } });
|
||||
}
|
||||
return okJson({ data: {} });
|
||||
}
|
||||
|
||||
await api.fetchMergedBloggerRecord("any-id", fetchImpl);
|
||||
|
||||
const target = urls.find((u) => String(u).includes("/v1/pugongying/data_summary"));
|
||||
assert.ok(target, "expected a call to /v1/pugongying/data_summary");
|
||||
|
||||
const parsed = new URL(target);
|
||||
assert.equal(parsed.searchParams.get("business"), "1");
|
||||
assert.equal(parsed.searchParams.get("userId"), "u-123");
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user