siluzan-tso-cli 1.1.74 → 1.1.75-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.js +1287 -124
- package/dist/skill/SKILL.md +8 -6
- package/dist/skill/_meta.json +2 -2
- package/dist/skill/assets/pmax-create-template.md +16 -2
- package/dist/skill/references/README.md +1 -0
- package/dist/skill/references/accounts/accounts-list.md +1 -1
- package/dist/skill/references/accounts/accounts-permissions.md +2 -2
- package/dist/skill/references/accounts/finance.md +1 -1
- package/dist/skill/references/accounts/open-account-by-media.md +1 -1
- package/dist/skill/references/accounts/open-account-google-ui.md +1 -1
- package/dist/skill/references/analytics/account-analytics.md +33 -0
- package/dist/skill/references/analytics/ga4-report.md +41 -0
- package/dist/skill/references/analytics/rag.md +1 -1
- package/dist/skill/references/analytics/reporting.md +5 -5
- package/dist/skill/references/core/agent-conventions.md +2 -0
- package/dist/skill/references/core/setup.md +5 -5
- package/dist/skill/references/core/workflows.md +3 -3
- package/dist/skill/references/google-ads/demand-gen-api.md +7 -6
- package/dist/skill/references/google-ads/google-ads-campaign-plan.md +1 -1
- package/dist/skill/references/google-ads/google-ads-write.md +18 -10
- package/dist/skill/references/google-ads/pmax-api.md +3 -1
- package/dist/skill/references/google-ads/rules/README.md +1 -1
- package/dist/skill/references/google-ads/rules/google-ads-audience-strategy.md +33 -33
- package/dist/skill/references/google-ads/rules/google-ads-launch-plan-template.md +1 -1
- package/dist/skill/references/google-ads/rules/google-ads-pmax-guide.md +24 -22
- package/dist/skill/references/google-ads/rules/google-ads-pmax-launch-plan-template.md +13 -2
- package/dist/skill/references/misc/tso-home.md +2 -2
- package/dist/skill/references/operations/ad-gap.md +120 -14
- package/dist/skill/scripts/install.ps1 +3 -3
- package/dist/skill/scripts/install.sh +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1967,6 +1967,7 @@ import * as fs from "fs";
|
|
|
1967
1967
|
import * as path from "path";
|
|
1968
1968
|
import * as os from "os";
|
|
1969
1969
|
import lockfile from "proper-lockfile";
|
|
1970
|
+
import { randomBytes } from "crypto";
|
|
1970
1971
|
import * as https from "https";
|
|
1971
1972
|
import * as http from "http";
|
|
1972
1973
|
import * as zlib from "zlib";
|
|
@@ -2397,7 +2398,7 @@ function rawRequest(url, options) {
|
|
|
2397
2398
|
stream = res.pipe(zlib.createBrotliDecompress());
|
|
2398
2399
|
}
|
|
2399
2400
|
let failed = false;
|
|
2400
|
-
const
|
|
2401
|
+
const fail10 = (err) => {
|
|
2401
2402
|
if (failed) return;
|
|
2402
2403
|
failed = true;
|
|
2403
2404
|
res.destroy();
|
|
@@ -2416,7 +2417,7 @@ function rawRequest(url, options) {
|
|
|
2416
2417
|
reject(err);
|
|
2417
2418
|
};
|
|
2418
2419
|
const onStreamError = (err) => {
|
|
2419
|
-
|
|
2420
|
+
fail10(new Error(`\u54CD\u5E94\u89E3\u538B\u5931\u8D25\uFF08${encoding || "identity"}\uFF09\uFF1A${err.message}`));
|
|
2420
2421
|
};
|
|
2421
2422
|
if (stream !== res) stream.on("error", onStreamError);
|
|
2422
2423
|
res.on("error", onStreamError);
|
|
@@ -2427,7 +2428,7 @@ function rawRequest(url, options) {
|
|
|
2427
2428
|
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
2428
2429
|
byteLen += buf.length;
|
|
2429
2430
|
if (maxBytes > 0 && byteLen > maxBytes) {
|
|
2430
|
-
|
|
2431
|
+
fail10(
|
|
2431
2432
|
new Error(`\u54CD\u5E94\u4F53\u8D85\u8FC7\u4E0A\u9650\uFF08${(maxBytes / 1024 / 1024).toFixed(0)} MB\uFF09\uFF0C\u5DF2\u4E2D\u65AD\u8FDE\u63A5`)
|
|
2432
2433
|
);
|
|
2433
2434
|
return;
|
|
@@ -2607,6 +2608,40 @@ function formatHttpError(status, rawBody, opts) {
|
|
|
2607
2608
|
function buildAuthHeaders(config) {
|
|
2608
2609
|
return buildSiluzanAuthHeaders(config);
|
|
2609
2610
|
}
|
|
2611
|
+
function buildMultipartBody(fields, files) {
|
|
2612
|
+
const boundary = `----SiluzanForm${randomBytes(16).toString("hex")}`;
|
|
2613
|
+
const chunks = [];
|
|
2614
|
+
for (const [name2, value] of Object.entries(fields)) {
|
|
2615
|
+
chunks.push(
|
|
2616
|
+
Buffer.from(
|
|
2617
|
+
`--${boundary}\r
|
|
2618
|
+
Content-Disposition: form-data; name="${name2}"\r
|
|
2619
|
+
\r
|
|
2620
|
+
${value}\r
|
|
2621
|
+
`
|
|
2622
|
+
)
|
|
2623
|
+
);
|
|
2624
|
+
}
|
|
2625
|
+
for (const file of files) {
|
|
2626
|
+
chunks.push(
|
|
2627
|
+
Buffer.from(
|
|
2628
|
+
`--${boundary}\r
|
|
2629
|
+
Content-Disposition: form-data; name="${file.field}"; filename="${file.filename}"\r
|
|
2630
|
+
Content-Type: ${file.contentType}\r
|
|
2631
|
+
\r
|
|
2632
|
+
`
|
|
2633
|
+
)
|
|
2634
|
+
);
|
|
2635
|
+
chunks.push(file.data);
|
|
2636
|
+
chunks.push(Buffer.from("\r\n"));
|
|
2637
|
+
}
|
|
2638
|
+
chunks.push(Buffer.from(`--${boundary}--\r
|
|
2639
|
+
`));
|
|
2640
|
+
return {
|
|
2641
|
+
body: Buffer.concat(chunks),
|
|
2642
|
+
contentType: `multipart/form-data; boundary=${boundary}`
|
|
2643
|
+
};
|
|
2644
|
+
}
|
|
2610
2645
|
async function parseApiResponse(status, text5, verbose) {
|
|
2611
2646
|
if (status < 200 || status >= 300) {
|
|
2612
2647
|
const err = new Error(formatHttpError(status, text5, { verbose }));
|
|
@@ -2667,6 +2702,22 @@ async function apiFetch(url, config, options = {}, verbose = false, timeoutMs) {
|
|
|
2667
2702
|
});
|
|
2668
2703
|
return parseApiResponse(res.status, res.text, verbose);
|
|
2669
2704
|
}
|
|
2705
|
+
async function apiFetchMultipart(url, config, payload, verbose = false) {
|
|
2706
|
+
const packed = buildMultipartBody(payload.fields ?? {}, payload.files);
|
|
2707
|
+
const reqHeaders = {
|
|
2708
|
+
"Content-Type": packed.contentType,
|
|
2709
|
+
"Accept-Language": "zh-CN",
|
|
2710
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
2711
|
+
...buildAuthHeaders(config),
|
|
2712
|
+
Datapermission: config.dataPermission ?? ""
|
|
2713
|
+
};
|
|
2714
|
+
const res = await rawRequest(url, {
|
|
2715
|
+
method: "POST",
|
|
2716
|
+
headers: reqHeaders,
|
|
2717
|
+
body: packed.body
|
|
2718
|
+
});
|
|
2719
|
+
return parseApiResponse(res.status, res.text, verbose);
|
|
2720
|
+
}
|
|
2670
2721
|
async function apiFetchWithHeaders(url, config, options = {}, verbose = false) {
|
|
2671
2722
|
const method = options.method ?? "GET";
|
|
2672
2723
|
const reqHeaders = {
|
|
@@ -4104,7 +4155,7 @@ var DEFAULT_API_BASE;
|
|
|
4104
4155
|
var init_defaults = __esm({
|
|
4105
4156
|
"src/config/defaults.ts"() {
|
|
4106
4157
|
"use strict";
|
|
4107
|
-
DEFAULT_API_BASE = "https://tso-api.siluzan.com";
|
|
4158
|
+
DEFAULT_API_BASE = "https://tso-api-ci.siluzan.com";
|
|
4108
4159
|
}
|
|
4109
4160
|
});
|
|
4110
4161
|
|
|
@@ -4415,6 +4466,11 @@ async function apiFetch2(url, config, options = {}, verbose = false, timeoutMs)
|
|
|
4415
4466
|
value: await apiFetch(url, config, options, verbose, timeoutMs)
|
|
4416
4467
|
}));
|
|
4417
4468
|
}
|
|
4469
|
+
async function apiFetchMultipart2(url, config, payload, verbose = false) {
|
|
4470
|
+
return withWriteAudit({ config, url, method: "POST", verbose }, async () => ({
|
|
4471
|
+
value: await apiFetchMultipart(url, config, payload, verbose)
|
|
4472
|
+
}));
|
|
4473
|
+
}
|
|
4418
4474
|
async function apiFetchWithHeaders2(url, config, options = {}, verbose = false) {
|
|
4419
4475
|
const method = options.method ?? "GET";
|
|
4420
4476
|
if (!isMutatingHttpMethod(method)) {
|
|
@@ -105518,18 +105574,18 @@ import fs32 from "fs";
|
|
|
105518
105574
|
import fsPromises2 from "fs/promises";
|
|
105519
105575
|
import path37 from "path";
|
|
105520
105576
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
105521
|
-
function resolveSkillTemplatePath3(
|
|
105577
|
+
function resolveSkillTemplatePath3(basename15) {
|
|
105522
105578
|
const dir = path37.dirname(fileURLToPath9(import.meta.url));
|
|
105523
105579
|
const candidates = [
|
|
105524
|
-
path37.join(dir, "skill", "report-templates",
|
|
105525
|
-
path37.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
105526
|
-
path37.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
105527
|
-
path37.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
105580
|
+
path37.join(dir, "skill", "report-templates", basename15),
|
|
105581
|
+
path37.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
105582
|
+
path37.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename15),
|
|
105583
|
+
path37.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
105528
105584
|
];
|
|
105529
105585
|
for (const candidate of candidates) {
|
|
105530
105586
|
if (fs32.existsSync(candidate)) return candidate;
|
|
105531
105587
|
}
|
|
105532
|
-
return path37.join(dir, "skill", "report-templates",
|
|
105588
|
+
return path37.join(dir, "skill", "report-templates", basename15);
|
|
105533
105589
|
}
|
|
105534
105590
|
function demandGenReportTemplatePath() {
|
|
105535
105591
|
return resolveSkillTemplatePath3(TEMPLATE_BASENAME);
|
|
@@ -107330,12 +107386,12 @@ import fs37 from "fs";
|
|
|
107330
107386
|
import fsPromises3 from "fs/promises";
|
|
107331
107387
|
import path42 from "path";
|
|
107332
107388
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
107333
|
-
function resolveSkillTemplatePath4(
|
|
107389
|
+
function resolveSkillTemplatePath4(basename15) {
|
|
107334
107390
|
const dir = path42.dirname(fileURLToPath10(import.meta.url));
|
|
107335
107391
|
const candidates = [
|
|
107336
|
-
path42.join(dir, "skill", "report-templates",
|
|
107337
|
-
path42.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
107338
|
-
path42.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
107392
|
+
path42.join(dir, "skill", "report-templates", basename15),
|
|
107393
|
+
path42.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
107394
|
+
path42.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
107339
107395
|
];
|
|
107340
107396
|
for (const p of candidates) {
|
|
107341
107397
|
if (fs37.existsSync(p)) return p;
|
|
@@ -107896,8 +107952,8 @@ var init_batch_runner = __esm({
|
|
|
107896
107952
|
shouldDowngrade(now = Date.now()) {
|
|
107897
107953
|
if (this.window.length < this.opts.windowSize) return false;
|
|
107898
107954
|
if (now - this.lastDowngradeAt < this.opts.cooldownMs) return false;
|
|
107899
|
-
const
|
|
107900
|
-
const rate2 =
|
|
107955
|
+
const fail10 = this.window.filter((s) => !s).length;
|
|
107956
|
+
const rate2 = fail10 / this.window.length;
|
|
107901
107957
|
if (rate2 >= this.opts.errorRateThreshold) {
|
|
107902
107958
|
this.lastDowngradeAt = now;
|
|
107903
107959
|
this.window.length = 0;
|
|
@@ -116648,8 +116704,17 @@ function campaignEditPatchPairs(input) {
|
|
|
116648
116704
|
if (input.negativeGeoTargetType !== void 0) {
|
|
116649
116705
|
pairs.push(["negativeGeoTargetType", input.negativeGeoTargetType]);
|
|
116650
116706
|
}
|
|
116707
|
+
if (input.audienceTargeting !== void 0) {
|
|
116708
|
+
pairs.push(["audienceTargeting", input.audienceTargeting]);
|
|
116709
|
+
}
|
|
116651
116710
|
return pairs;
|
|
116652
116711
|
}
|
|
116712
|
+
function parseAudienceTargeting(raw) {
|
|
116713
|
+
const text5 = raw.trim().replace(/[_-]/g, "").toLowerCase();
|
|
116714
|
+
if (text5 === "observation") return "Observation";
|
|
116715
|
+
if (text5 === "targeting") return "Targeting";
|
|
116716
|
+
return void 0;
|
|
116717
|
+
}
|
|
116653
116718
|
function campaignStatusPatchPairs(status) {
|
|
116654
116719
|
return [["status", status]];
|
|
116655
116720
|
}
|
|
@@ -119745,8 +119810,22 @@ async function runAdCampaignBiddingStrategies(opts) {
|
|
|
119745
119810
|
`
|
|
119746
119811
|
);
|
|
119747
119812
|
}
|
|
119813
|
+
function parseCampaignAudienceTargeting(raw) {
|
|
119814
|
+
if (raw === void 0) return void 0;
|
|
119815
|
+
const parsed = parseAudienceTargeting(raw);
|
|
119816
|
+
if (!parsed) {
|
|
119817
|
+
console.error("\n\u274C --audience-targeting \u65E0\u6548\uFF0C\u5408\u6CD5\u503C\uFF1AObservation | Targeting\n");
|
|
119818
|
+
process.exit(1);
|
|
119819
|
+
}
|
|
119820
|
+
return parsed;
|
|
119821
|
+
}
|
|
119822
|
+
function isSearchChannel(channel) {
|
|
119823
|
+
const text5 = String(channel ?? "").trim();
|
|
119824
|
+
if (!text5) return true;
|
|
119825
|
+
return text5.replace(/[_-]/g, "").toUpperCase() === "SEARCH";
|
|
119826
|
+
}
|
|
119748
119827
|
function parseCampaignEditGeoTargetTypes(opts) {
|
|
119749
|
-
const
|
|
119828
|
+
const fail10 = (flag, value, allowed) => {
|
|
119750
119829
|
console.error(`
|
|
119751
119830
|
\u274C ${flag} \u65E0\u6548\uFF08${value}\uFF09\uFF0C\u5408\u6CD5\u503C\uFF1A${allowed}
|
|
119752
119831
|
`);
|
|
@@ -119757,13 +119836,13 @@ function parseCampaignEditGeoTargetTypes(opts) {
|
|
|
119757
119836
|
if (opts.geoTargetType !== void 0) {
|
|
119758
119837
|
positive = parsePositiveGeoTargetType(opts.geoTargetType) ?? void 0;
|
|
119759
119838
|
if (!positive) {
|
|
119760
|
-
|
|
119839
|
+
fail10("--geo-target-type", opts.geoTargetType, Object.keys(GEO_TARGET_TYPE_CLI_VALUES).join(" | "));
|
|
119761
119840
|
}
|
|
119762
119841
|
}
|
|
119763
119842
|
if (opts.negativeGeoTargetType !== void 0) {
|
|
119764
119843
|
negative = parseNegativeGeoTargetType(opts.negativeGeoTargetType) ?? void 0;
|
|
119765
119844
|
if (!negative) {
|
|
119766
|
-
|
|
119845
|
+
fail10("--negative-geo-target-type", opts.negativeGeoTargetType, "presence | presence-or-interest");
|
|
119767
119846
|
}
|
|
119768
119847
|
}
|
|
119769
119848
|
return { positive, negative };
|
|
@@ -119798,6 +119877,7 @@ async function runAdCampaignEdit(opts) {
|
|
|
119798
119877
|
opts = withResolvedAdAccount(opts);
|
|
119799
119878
|
validateCampaignEditBidding(opts);
|
|
119800
119879
|
const geoTargetTypes = parseCampaignEditGeoTargetTypes(opts);
|
|
119880
|
+
const audienceTargeting = parseCampaignAudienceTargeting(opts.audienceTargeting);
|
|
119801
119881
|
const config = loadConfig(opts.token);
|
|
119802
119882
|
const googleApiUrl = requireGoogleApi(config);
|
|
119803
119883
|
const detailUrl = `${googleApiUrl}/campaignmanagement/campaign/${opts.account}/${opts.id}`;
|
|
@@ -119829,10 +119909,20 @@ async function runAdCampaignEdit(opts) {
|
|
|
119829
119909
|
targetSearchNetwork: opts.targetSearchNetwork,
|
|
119830
119910
|
targetContentNetwork: opts.targetContentNetwork,
|
|
119831
119911
|
positiveGeoTargetType: geoTargetTypes.positive,
|
|
119832
|
-
negativeGeoTargetType: geoTargetTypes.negative
|
|
119912
|
+
negativeGeoTargetType: geoTargetTypes.negative,
|
|
119913
|
+
audienceTargeting
|
|
119833
119914
|
});
|
|
119834
119915
|
if (patchPairs.length === 0) {
|
|
119835
|
-
console.error("\n\u274C \u8BF7\u81F3\u5C11\u6307\u5B9A\u4E00\u4E2A\u4FEE\u6539\u9879\uFF08--name / --budget / --bidding / --geo-target-type / \u2026\uFF09\n");
|
|
119916
|
+
console.error("\n\u274C \u8BF7\u81F3\u5C11\u6307\u5B9A\u4E00\u4E2A\u4FEE\u6539\u9879\uFF08--name / --budget / --bidding / --geo-target-type / --audience-targeting / \u2026\uFF09\n");
|
|
119917
|
+
process.exit(1);
|
|
119918
|
+
}
|
|
119919
|
+
if (audienceTargeting && !isSearchChannel(campaign.channelTypeV2 ?? campaign.ChannelTypeV2)) {
|
|
119920
|
+
const channel = String(campaign.channelTypeV2 ?? campaign.ChannelTypeV2 ?? "");
|
|
119921
|
+
console.error(
|
|
119922
|
+
`
|
|
119923
|
+
\u274C --audience-targeting \u53EA\u7528\u4E8E\u641C\u7D22\u7CFB\u5217\u3002\u5F53\u524D\u6E20\u9053\u662F ${channel || "\u672A\u77E5"}\u3002
|
|
119924
|
+
`
|
|
119925
|
+
);
|
|
119836
119926
|
process.exit(1);
|
|
119837
119927
|
}
|
|
119838
119928
|
if (opts.budget !== void 0 && readBudgetSharedFlag(campaign) === true) {
|
|
@@ -119881,6 +119971,9 @@ async function runAdCampaignEdit(opts) {
|
|
|
119881
119971
|
parts.push(`\u4F4D\u7F6E\u9009\u9879\u2192${GEO_TARGET_TYPE_LABEL[geoTargetTypes.positive]}`);
|
|
119882
119972
|
}
|
|
119883
119973
|
if (geoTargetTypes.negative) parts.push(`\u6392\u9664\u4F4D\u7F6E\u9009\u9879\u2192${geoTargetTypes.negative}`);
|
|
119974
|
+
if (audienceTargeting) {
|
|
119975
|
+
parts.push(`\u53D7\u4F17\u2192${audienceTargeting === "Observation" ? "\u89C2\u5BDF" : "\u5B9A\u5411"}`);
|
|
119976
|
+
}
|
|
119884
119977
|
const judged = await verifyCampaignAfterPut(
|
|
119885
119978
|
detailUrl,
|
|
119886
119979
|
config,
|
|
@@ -120511,7 +120604,8 @@ var EXCLUSION_TYPES = [
|
|
|
120511
120604
|
"youtube-channel",
|
|
120512
120605
|
"youtube-video",
|
|
120513
120606
|
"app",
|
|
120514
|
-
"app-category"
|
|
120607
|
+
"app-category",
|
|
120608
|
+
"user-list"
|
|
120515
120609
|
];
|
|
120516
120610
|
var RESERVED_PLACEMENT_SUFFIXES = [".invalid", ".example", ".test", ".localhost"];
|
|
120517
120611
|
function normalizePlacementUrl(raw) {
|
|
@@ -120549,7 +120643,7 @@ function buildExclusionCreateBody(input) {
|
|
|
120549
120643
|
const type = input.type.trim().toLowerCase();
|
|
120550
120644
|
if (!EXCLUSION_TYPES.includes(type)) {
|
|
120551
120645
|
throw new Error(
|
|
120552
|
-
"type \u987B\u4E3A content-label | placement | youtube-channel | youtube-video | app | app-category"
|
|
120646
|
+
"type \u987B\u4E3A content-label | placement | youtube-channel | youtube-video | app | app-category | user-list"
|
|
120553
120647
|
);
|
|
120554
120648
|
}
|
|
120555
120649
|
const filled = [
|
|
@@ -120558,10 +120652,11 @@ function buildExclusionCreateBody(input) {
|
|
|
120558
120652
|
input.channelId,
|
|
120559
120653
|
input.videoId,
|
|
120560
120654
|
input.appId,
|
|
120561
|
-
input.appCategoryId
|
|
120655
|
+
input.appCategoryId,
|
|
120656
|
+
input.userListId
|
|
120562
120657
|
].filter((value) => value != null && String(value).trim() !== "");
|
|
120563
120658
|
if (filled.length !== 1) {
|
|
120564
|
-
throw new Error("\u4E00\u6B21\u53EA\u586B\u4E00\u79CD\u503C\uFF1A\u5185\u5BB9\u6807\u7B7E\u3001\u7F51\u5740\u3001\u9891\u9053\u3001\u89C6\u9891\u3001\u5E94\u7528\
|
|
120659
|
+
throw new Error("\u4E00\u6B21\u53EA\u586B\u4E00\u79CD\u503C\uFF1A\u5185\u5BB9\u6807\u7B7E\u3001\u7F51\u5740\u3001\u9891\u9053\u3001\u89C6\u9891\u3001\u5E94\u7528\u3001\u5E94\u7528\u7C7B\u522B\u6216\u7528\u6237\u5217\u8868 id");
|
|
120565
120660
|
}
|
|
120566
120661
|
if (type === "content-label") {
|
|
120567
120662
|
const contentLabel = input.contentLabel?.trim() ?? "";
|
|
@@ -120588,11 +120683,18 @@ function buildExclusionCreateBody(input) {
|
|
|
120588
120683
|
}
|
|
120589
120684
|
return { type, appId };
|
|
120590
120685
|
}
|
|
120591
|
-
|
|
120592
|
-
|
|
120593
|
-
|
|
120686
|
+
if (type === "app-category") {
|
|
120687
|
+
const appCategoryId = input.appCategoryId?.trim() ?? "";
|
|
120688
|
+
if (!/^\d+$/.test(appCategoryId)) {
|
|
120689
|
+
throw new Error("app-category \u9700\u8981 app-categories \u8FD4\u56DE\u7684\u6570\u5B57 --app-category-id");
|
|
120690
|
+
}
|
|
120691
|
+
return { type, appCategoryId };
|
|
120692
|
+
}
|
|
120693
|
+
const userListId = input.userListId?.trim() ?? "";
|
|
120694
|
+
if (!/^\d+$/.test(userListId)) {
|
|
120695
|
+
throw new Error("user-list \u9700\u8981\u5DF2\u6709\u7528\u6237\u5217\u8868\u7684\u6570\u5B57 --user-list-id\u3002\u4E0A\u4F20\u540D\u5355\u8D70 Customer Match\uFF0C\u4E0D\u5728\u8FD9\u91CC\u505A\u3002");
|
|
120594
120696
|
}
|
|
120595
|
-
return { type,
|
|
120697
|
+
return { type, userListId };
|
|
120596
120698
|
}
|
|
120597
120699
|
function exclusionsUrl(googleApiUrl, accountId) {
|
|
120598
120700
|
return `${googleApiUrl}/campaignmanagement/accounts/${accountId}/exclusions`;
|
|
@@ -122807,8 +122909,8 @@ async function runAdGeoSearch(opts) {
|
|
|
122807
122909
|
name: geoItemDisplayName(item) || null,
|
|
122808
122910
|
targetType: geoItemType(item) || null
|
|
122809
122911
|
}));
|
|
122810
|
-
const
|
|
122811
|
-
const picked =
|
|
122912
|
+
const pick3 = pickGeoCandidate(opts.query, items3);
|
|
122913
|
+
const picked = pick3.picked;
|
|
122812
122914
|
const pickedId = picked ? String(picked["id"] ?? "") || null : null;
|
|
122813
122915
|
const payload = {
|
|
122814
122916
|
account: opts.account,
|
|
@@ -122816,8 +122918,8 @@ async function runAdGeoSearch(opts) {
|
|
|
122816
122918
|
itemCount: rows.length,
|
|
122817
122919
|
items: rows,
|
|
122818
122920
|
/** ok=同名候选(Country 优先);needs_review=无同名候选未自动选;unserved=Google 不投放地区 */
|
|
122819
|
-
pickStatus:
|
|
122820
|
-
pickNote:
|
|
122921
|
+
pickStatus: pick3.status,
|
|
122922
|
+
pickNote: pick3.note ?? null,
|
|
122821
122923
|
picked: picked ? {
|
|
122822
122924
|
id: pickedId,
|
|
122823
122925
|
name: geoItemDisplayName(picked) || null,
|
|
@@ -122860,7 +122962,7 @@ async function runAdGeoSearch(opts) {
|
|
|
122860
122962
|
);
|
|
122861
122963
|
} else {
|
|
122862
122964
|
console.log(`
|
|
122863
|
-
\u26A0\uFE0F \u672A\u81EA\u52A8\u9009\u62E9\uFF1A${
|
|
122965
|
+
\u26A0\uFE0F \u672A\u81EA\u52A8\u9009\u62E9\uFF1A${pick3.note ?? "\u65E0\u540C\u540D\u5019\u9009"}
|
|
122864
122966
|
`);
|
|
122865
122967
|
}
|
|
122866
122968
|
}
|
|
@@ -122905,17 +123007,17 @@ function parseGeoResolveQueries(opts) {
|
|
|
122905
123007
|
}
|
|
122906
123008
|
var GEO_RESOLVE_CONCURRENCY = 6;
|
|
122907
123009
|
function buildGeoResolveRow(query, items3) {
|
|
122908
|
-
const
|
|
123010
|
+
const pick3 = pickGeoCandidate(query, items3);
|
|
122909
123011
|
const row = {
|
|
122910
123012
|
query,
|
|
122911
|
-
id:
|
|
122912
|
-
name:
|
|
122913
|
-
targetType:
|
|
122914
|
-
status:
|
|
123013
|
+
id: pick3.picked ? String(pick3.picked["id"] ?? "") || null : null,
|
|
123014
|
+
name: pick3.picked ? geoItemDisplayName(pick3.picked) || null : null,
|
|
123015
|
+
targetType: pick3.picked ? geoItemType(pick3.picked) || null : null,
|
|
123016
|
+
status: pick3.status,
|
|
122915
123017
|
candidates: items3.length
|
|
122916
123018
|
};
|
|
122917
|
-
if (
|
|
122918
|
-
if (
|
|
123019
|
+
if (pick3.note) row.note = pick3.note;
|
|
123020
|
+
if (pick3.status === "needs_review") {
|
|
122919
123021
|
row.topCandidates = items3.slice(0, 5).map((it) => ({
|
|
122920
123022
|
id: String(it["id"] ?? ""),
|
|
122921
123023
|
name: geoItemDisplayName(it)
|
|
@@ -129475,6 +129577,25 @@ async function runAdSharedBudgetUpdate(opts) {
|
|
|
129475
129577
|
\u2705 \u5DF2\u4FEE\u6539\u5171\u4EAB\u9884\u7B97 ${budgetId}\u300C${name2}\u300D\u3002\u540C\u4E00\u9884\u7B97\u4E0B\u7684\u7CFB\u5217\u4F1A\u4E00\u8D77\u53D8\u3002
|
|
129476
129578
|
`);
|
|
129477
129579
|
}
|
|
129580
|
+
function sharedBudgetAttachUrl(base2, account, campaignId, budgetId) {
|
|
129581
|
+
return `${base2}/campaignmanagement/campaign/${account}/${campaignId}/shared-budget/${budgetId}`;
|
|
129582
|
+
}
|
|
129583
|
+
async function runAdSharedBudgetAttach(opts) {
|
|
129584
|
+
const campaignId = (opts.campaignId ?? "").trim();
|
|
129585
|
+
const budgetId = (opts.budgetId ?? "").trim();
|
|
129586
|
+
if (!/^\d+$/.test(campaignId)) fail3(new Error("--campaign-id \u987B\u4E3A\u6570\u5B57"), "\u53C2\u6570");
|
|
129587
|
+
if (!/^\d+$/.test(budgetId)) fail3(new Error("--budget-id \u987B\u4E3A\u6570\u5B57"), "\u53C2\u6570");
|
|
129588
|
+
const { config, base: base2, account } = accountBase3(opts);
|
|
129589
|
+
const url = sharedBudgetAttachUrl(base2, account, campaignId, budgetId);
|
|
129590
|
+
try {
|
|
129591
|
+
await apiFetch2(url, config, { method: "POST" }, opts.verbose);
|
|
129592
|
+
} catch (err) {
|
|
129593
|
+
fail3(err, "\u628A\u7CFB\u5217\u6302\u5230\u5171\u4EAB\u9884\u7B97\u5931\u8D25");
|
|
129594
|
+
}
|
|
129595
|
+
console.log(`
|
|
129596
|
+
\u2705 \u7CFB\u5217 ${campaignId} \u5DF2\u6539\u6302\u5230\u9884\u7B97 ${budgetId}\u3002\u91D1\u989D\u6CA1\u6709\u6539\u3002Demand Gen \u4F1A\u88AB\u62D2\u7EDD\u3002
|
|
129597
|
+
`);
|
|
129598
|
+
}
|
|
129478
129599
|
async function runAdSharedBudgetDelete(opts) {
|
|
129479
129600
|
const budgetId = (opts.budgetId ?? "").trim();
|
|
129480
129601
|
if (!/^\d+$/.test(budgetId)) fail3(new Error("--budget-id \u987B\u4E3A\u6570\u5B57"), "\u53C2\u6570");
|
|
@@ -131478,7 +131599,7 @@ function register21(program2) {
|
|
|
131478
131599
|
verbose: opts.verbose
|
|
131479
131600
|
});
|
|
131480
131601
|
});
|
|
131481
|
-
adCmd.command("campaign-edit").description("\u7F16\u8F91\u641C\u7D22\u5E7F\u544A\u7CFB\u5217\u3002\u540D\u79F0\u3001\u9884\u7B97\u3001\u51FA\u4EF7\u3001\u6295\u653E\u7F51\u7EDC\u3001\u4F4D\u7F6E\u9009\u9879\u90FD\u8D70\u5B57\u6BB5\u7EA7 PATCH\u3002\u81F3\u5C11\u4F20\u4E00\u4E2A\u4FEE\u6539\u9879").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption("--id <campaignId>", "\u5E7F\u544A\u7CFB\u5217 ID").option("--name <name>", "\u65B0\u540D\u79F0").option(
|
|
131602
|
+
adCmd.command("campaign-edit").description("\u7F16\u8F91\u641C\u7D22\u5E7F\u544A\u7CFB\u5217\u3002\u540D\u79F0\u3001\u9884\u7B97\u3001\u51FA\u4EF7\u3001\u6295\u653E\u7F51\u7EDC\u3001\u4F4D\u7F6E\u9009\u9879\u3001\u53D7\u4F17\u89C2\u5BDF/\u5B9A\u5411\u90FD\u8D70\u5B57\u6BB5\u7EA7 PATCH\u3002\u81F3\u5C11\u4F20\u4E00\u4E2A\u4FEE\u6539\u9879").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption("--id <campaignId>", "\u5E7F\u544A\u7CFB\u5217 ID").option("--name <name>", "\u65B0\u540D\u79F0").option(
|
|
131482
131603
|
"--budget <amount>",
|
|
131483
131604
|
"\u65B0\u9884\u7B97\uFF0C\u4E3B\u5E01\u79CD\u91D1\u989D\uFF08\u5982 100 \u8868\u793A \xA5100\uFF1B\u652F\u6301\u5C0F\u6570\uFF1BCLI \u5185\u90E8\u81EA\u52A8 \xD7100 \u5199\u5165\u300C\u5206\u300D\u5B57\u6BB5\uFF09",
|
|
131484
131605
|
parseFloat
|
|
@@ -131511,6 +131632,9 @@ function register21(program2) {
|
|
|
131511
131632
|
).option(
|
|
131512
131633
|
"--negative-geo-target-type <type>",
|
|
131513
131634
|
"\u4F4D\u7F6E\u9009\u9879\uFF08\u6392\u9664\uFF09\uFF1Apresence\uFF08\u6392\u9664\u8EAB\u5904\u8BE5\u5730\u7684\u4EBA\uFF09| presence-or-interest\uFF08\u8EAB\u5904\u6216\u5173\u6CE8\u8BE5\u5730\u7684\u4EBA\u90FD\u6392\u9664\uFF09"
|
|
131635
|
+
).option(
|
|
131636
|
+
"--audience-targeting <mode>",
|
|
131637
|
+
"\u641C\u7D22\u53D7\u4F17\uFF1AObservation\uFF08\u89C2\u5BDF\uFF0C\u4ECD\u53EF\u6295\u7ED9\u5176\u4ED6\u4EBA\uFF09| Targeting\uFF08\u5B9A\u5411\uFF0C\u53EA\u6295\u7ED9\u5DF2\u52A0\u7684\u53D7\u4F17\uFF09\u3002\u975E\u641C\u7D22\u7CFB\u5217\u62D2\u7EDD"
|
|
131514
131638
|
).option("--json-out <path>", "\u843D\u76D8\u6838\u9A8C\u7ED3\u679C\uFF08writeScope=search-field-patch\uFF09").option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
131515
131639
|
async (opts) => {
|
|
131516
131640
|
await runAdCampaignEdit({
|
|
@@ -131528,6 +131652,7 @@ function register21(program2) {
|
|
|
131528
131652
|
targetContentNetwork: opts.contentNetwork,
|
|
131529
131653
|
geoTargetType: opts.geoTargetType,
|
|
131530
131654
|
negativeGeoTargetType: opts.negativeGeoTargetType,
|
|
131655
|
+
audienceTargeting: opts.audienceTargeting,
|
|
131531
131656
|
jsonOut: opts.jsonOut,
|
|
131532
131657
|
verbose: opts.verbose
|
|
131533
131658
|
});
|
|
@@ -132095,21 +132220,21 @@ function register21(program2) {
|
|
|
132095
132220
|
}
|
|
132096
132221
|
function registerAccountOps(adCmd) {
|
|
132097
132222
|
const exclusions = adCmd.command("exclusions").description(
|
|
132098
|
-
"\u8D26\u6237\u7EA7\u5185\u5BB9\u9002\u5B9C\u6027\u6392\u9664\uFF08\u654F\u611F\u5185\u5BB9\u3001\u7C7B\u578B\u548C\u6807\u7B7E\u3001\u5185\u5BB9\u4E3B\u9898\u3001\u7F51\u7AD9\u3001YouTube\u3001\u5E94\u7528\u3001\u5E94\u7528\u7C7B\u522B\uFF09\u3002\u5168\u8D26\u6237\u751F\u6548\u3002\u4E0D\u662F\u5C55\u793A\u5E7F\u544A\u521B\u5EFA\uFF0C\u4E5F\u4E0D\u662F\u641C\u7D22\u5426\u8BCD\u6216\u5185\u5BB9\u5173\u952E\u5B57"
|
|
132223
|
+
"\u8D26\u6237\u7EA7\u5185\u5BB9\u9002\u5B9C\u6027\u6392\u9664\uFF08\u654F\u611F\u5185\u5BB9\u3001\u7C7B\u578B\u548C\u6807\u7B7E\u3001\u5185\u5BB9\u4E3B\u9898\u3001\u7F51\u7AD9\u3001YouTube\u3001\u5E94\u7528\u3001\u5E94\u7528\u7C7B\u522B\uFF09\u3002user-list \u4F1A\u5728\u7F51\u5173\u62D2\u7EDD\uFF1A\u5BA2\u6237\u7EA7\u5426\u5B9A\u51C6\u5219\u6CA1\u6709\u7528\u6237\u5217\u8868\u5B57\u6BB5\u3002\u5168\u8D26\u6237\u751F\u6548\u3002\u4E0D\u662F\u5C55\u793A\u5E7F\u544A\u521B\u5EFA\uFF0C\u4E5F\u4E0D\u662F\u641C\u7D22\u5426\u8BCD\u6216\u5185\u5BB9\u5173\u952E\u5B57"
|
|
132099
132224
|
);
|
|
132100
132225
|
exclusions.command("list").description("\u5217\u51FA\u5DF2\u751F\u6548\u7684\u8D26\u6237\u7EA7\u5185\u5BB9\u6392\u9664").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").option(
|
|
132101
132226
|
"--type <type>",
|
|
132102
|
-
"content-label | placement | youtube-channel | youtube-video | app | app-category"
|
|
132227
|
+
"content-label | placement | youtube-channel | youtube-video | app | app-category | user-list"
|
|
132103
132228
|
).option("--json-out <path>", "\u843D\u76D8").option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132104
132229
|
await runAdExclusionsList(opts);
|
|
132105
132230
|
});
|
|
132106
132231
|
exclusions.command("add").description("\u6DFB\u52A0\u4E00\u6761\u8D26\u6237\u7EA7\u6392\u9664\u3002\u4E00\u6B21\u4E00\u79CD\u7C7B\u578B\u3002\u5199\u64CD\u4F5C\u987B --commit\u3002\u5148 list\uFF0C\u5E76\u5411\u7528\u6237\u786E\u8BA4").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption(
|
|
132107
132232
|
"--type <type>",
|
|
132108
|
-
"content-label | placement | youtube-channel | youtube-video | app | app-category"
|
|
132233
|
+
"content-label | placement | youtube-channel | youtube-video | app | app-category | user-list"
|
|
132109
132234
|
).option(
|
|
132110
132235
|
"--content-label <name>",
|
|
132111
132236
|
"\u5185\u5BB9\u6807\u7B7E proto \u540D\uFF0C\u6765\u81EA content-labels\uFF0C\u5982 BRAND_SUITABILITY_GAMES_FIGHTING"
|
|
132112
|
-
).option("--url <url>", "\u8981\u6392\u9664\u7684\u7F51\u7AD9").option("--channel-id <id>", "YouTube \u9891\u9053 ID").option("--video-id <id>", "YouTube \u89C6\u9891 ID").option("--app-id <id>", "\u5E94\u7528 ID\uFF1A1-\u6570\u5B57 \u6216 2-\u5305\u540D").option("--app-category-id <id>", "\u5E94\u7528\u7C7B\u522B\u6570\u5B57 id\uFF0C\u6765\u81EA app-categories").option("--json-out <path>", "\u843D\u76D8").option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132237
|
+
).option("--url <url>", "\u8981\u6392\u9664\u7684\u7F51\u7AD9").option("--channel-id <id>", "YouTube \u9891\u9053 ID").option("--video-id <id>", "YouTube \u89C6\u9891 ID").option("--app-id <id>", "\u5E94\u7528 ID\uFF1A1-\u6570\u5B57 \u6216 2-\u5305\u540D").option("--app-category-id <id>", "\u5E94\u7528\u7C7B\u522B\u6570\u5B57 id\uFF0C\u6765\u81EA app-categories").option("--user-list-id <id>", "\u5DF2\u6709\u7528\u6237\u5217\u8868\u7684\u6570\u5B57 id\u3002\u4E0D\u4E0A\u4F20\u540D\u5355").option("--json-out <path>", "\u843D\u76D8").option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132113
132238
|
await runAdExclusionsAdd({
|
|
132114
132239
|
token: opts.token,
|
|
132115
132240
|
account: opts.account,
|
|
@@ -132120,6 +132245,7 @@ function registerAccountOps(adCmd) {
|
|
|
132120
132245
|
videoId: opts.videoId,
|
|
132121
132246
|
appId: opts.appId,
|
|
132122
132247
|
appCategoryId: opts.appCategoryId,
|
|
132248
|
+
userListId: opts.userListId,
|
|
132123
132249
|
jsonOut: opts.jsonOut,
|
|
132124
132250
|
verbose: opts.verbose
|
|
132125
132251
|
});
|
|
@@ -132239,6 +132365,9 @@ function registerProtection(adCmd) {
|
|
|
132239
132365
|
sharedBudget.command("update").description("\u6539\u4E00\u4EFD\u5171\u4EAB\u9884\u7B97\u7684\u540D\u79F0\u6216\u91D1\u989D\u3002\u540C\u4E00\u9884\u7B97\u4E0B\u7684\u7CFB\u5217\u4F1A\u4E00\u8D77\u53D8\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption("--budget-id <id>", "list \u91CC\u7684 id").option("--name <name>", "\u65B0\u540D\u79F0\uFF0C\u4E0D\u4F20\u5219\u4FDD\u6301\u539F\u540D").option("--amount <yuan>", "\u65B0\u65E5\u9884\u7B97\uFF0C\u4E3B\u5E01\u79CD\u5143", (value) => Number(value)).option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132240
132366
|
await runAdSharedBudgetUpdate(opts);
|
|
132241
132367
|
});
|
|
132368
|
+
sharedBudget.command("attach").description("\u628A\u5DF2\u6709\u7CFB\u5217\u6539\u6302\u5230\u4E00\u4EFD\u5171\u4EAB\u9884\u7B97\u3002\u4E0D\u6539\u91D1\u989D\u3002Demand Gen \u4F1A\u62D2\u7EDD\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption("--campaign-id <id>", "\u8981\u6539\u6302\u7684\u7CFB\u5217 id").requiredOption("--budget-id <id>", "list \u91CC\u7684\u5171\u4EAB\u9884\u7B97 id").option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132369
|
+
await runAdSharedBudgetAttach(opts);
|
|
132370
|
+
});
|
|
132242
132371
|
sharedBudget.command("delete").description("\u5220\u9664\u5171\u4EAB\u9884\u7B97\u3002\u987B --i-confirm\u3002\u4ECD\u88AB\u7CFB\u5217\u4F7F\u7528\u65F6 Google \u4F1A\u62D2\u7EDD").requiredOption("-a, --account <id>", "Google \u8D26\u6237 mediaCustomerId").requiredOption("--budget-id <id>", "list \u91CC\u7684 id").option("--i-confirm", "\u7528\u6237\u5DF2\u786E\u8BA4\u5220\u9664", false).option("-t, --token <token>", "Auth Token").option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
132243
132372
|
await runAdSharedBudgetDelete(opts);
|
|
132244
132373
|
});
|
|
@@ -139344,12 +139473,12 @@ async function runOpenAccountGoogleWizard(opts) {
|
|
|
139344
139473
|
` \u2026 \u5171 ${rows.length} \u6761\uFF0C\u4E5F\u53EF\u7528\uFF1Asiluzan-tso open-account google-timezones --keyword Tokyo
|
|
139345
139474
|
`
|
|
139346
139475
|
);
|
|
139347
|
-
const
|
|
139348
|
-
const n = parseInt(
|
|
139476
|
+
const pick3 = await q("\n\u8F93\u5165\u5E8F\u53F7\uFF081-60\uFF09\u6216\u76F4\u63A5\u7C98\u8D34 Code\uFF1A");
|
|
139477
|
+
const n = parseInt(pick3, 10);
|
|
139349
139478
|
if (!Number.isNaN(n) && n >= 1 && n <= Math.min(60, rows.length)) {
|
|
139350
139479
|
timezone = String(rows[n - 1]?.Code ?? timezone);
|
|
139351
|
-
} else if (
|
|
139352
|
-
timezone =
|
|
139480
|
+
} else if (pick3) {
|
|
139481
|
+
timezone = pick3;
|
|
139353
139482
|
}
|
|
139354
139483
|
} else if (tzAns) {
|
|
139355
139484
|
timezone = tzAns;
|
|
@@ -141155,12 +141284,12 @@ var TEMPLATE_BASENAMES = {
|
|
|
141155
141284
|
html: "website-diagnosis-report.html",
|
|
141156
141285
|
runtime: "website-diagnosis-report.runtime.js"
|
|
141157
141286
|
};
|
|
141158
|
-
function resolveSkillTemplatePath(
|
|
141287
|
+
function resolveSkillTemplatePath(basename15) {
|
|
141159
141288
|
const dir = path25.dirname(fileURLToPath4(import.meta.url));
|
|
141160
141289
|
const candidates = [
|
|
141161
|
-
path25.join(dir, "skill", "report-templates",
|
|
141162
|
-
path25.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
141163
|
-
path25.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
141290
|
+
path25.join(dir, "skill", "report-templates", basename15),
|
|
141291
|
+
path25.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
141292
|
+
path25.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
141164
141293
|
];
|
|
141165
141294
|
for (const p of candidates) {
|
|
141166
141295
|
if (fs20.existsSync(p)) return p;
|
|
@@ -142126,13 +142255,13 @@ function buildGoogleAdsDiagnosisNarrativeChecks() {
|
|
|
142126
142255
|
return checks;
|
|
142127
142256
|
}
|
|
142128
142257
|
var GOOGLE_ADS_DIAGNOSIS_NARRATIVE_CHECKS = buildGoogleAdsDiagnosisNarrativeChecks();
|
|
142129
|
-
function resolveSkillTemplatePath2(
|
|
142258
|
+
function resolveSkillTemplatePath2(basename15) {
|
|
142130
142259
|
const dir = path27.dirname(fileURLToPath5(import.meta.url));
|
|
142131
142260
|
const candidates = [
|
|
142132
|
-
path27.join(dir, "skill", "report-templates",
|
|
142133
|
-
path27.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
142134
|
-
path27.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
142135
|
-
path27.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
142261
|
+
path27.join(dir, "skill", "report-templates", basename15),
|
|
142262
|
+
path27.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
142263
|
+
path27.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15),
|
|
142264
|
+
path27.join(dir, "..", "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
142136
142265
|
];
|
|
142137
142266
|
for (const p of candidates) {
|
|
142138
142267
|
if (fs22.existsSync(p)) return p;
|
|
@@ -144503,7 +144632,7 @@ function channelBucket(channelTypeV2) {
|
|
|
144503
144632
|
if (raw === "DISPLAY") return "\u5C55\u793A";
|
|
144504
144633
|
return "\u5176\u4ED6";
|
|
144505
144634
|
}
|
|
144506
|
-
function
|
|
144635
|
+
function isSearchChannel2(channelTypeV2) {
|
|
144507
144636
|
return channelBucket(channelTypeV2) === "\u641C\u7D22";
|
|
144508
144637
|
}
|
|
144509
144638
|
function spendByChannel(rows) {
|
|
@@ -145169,7 +145298,7 @@ function pickSpecialAds(videos, campaigns) {
|
|
|
145169
145298
|
return { source: "pmax", label: "\u6548\u679C\u6700\u5927\u5316", items: pmax };
|
|
145170
145299
|
}
|
|
145171
145300
|
const other = sortBySpend(
|
|
145172
|
-
campaigns.filter((row) => !
|
|
145301
|
+
campaigns.filter((row) => !isSearchChannel2(row.channelTypeV2) && hasTraffic(row)).map(fromCampaign)
|
|
145173
145302
|
);
|
|
145174
145303
|
if (other.length > 0) {
|
|
145175
145304
|
return { source: "other", label: "\u975E\u641C\u7D22\u5E7F\u544A", items: other };
|
|
@@ -145814,6 +145943,237 @@ function registerGoogleQuarterlyCommands(program2) {
|
|
|
145814
145943
|
);
|
|
145815
145944
|
}
|
|
145816
145945
|
|
|
145946
|
+
// src/commands/ga4.ts
|
|
145947
|
+
init_auth();
|
|
145948
|
+
init_cli_json_snapshot();
|
|
145949
|
+
init_cli_table();
|
|
145950
|
+
init_shared();
|
|
145951
|
+
var GA4_REPORT_DIMENSIONS = [
|
|
145952
|
+
"date",
|
|
145953
|
+
"eventName",
|
|
145954
|
+
"sessionDefaultChannelGroup",
|
|
145955
|
+
"pagePath",
|
|
145956
|
+
"deviceCategory",
|
|
145957
|
+
"country",
|
|
145958
|
+
"sessionSourceMedium"
|
|
145959
|
+
];
|
|
145960
|
+
var GA4_REPORT_METRICS = [
|
|
145961
|
+
"sessions",
|
|
145962
|
+
"newUsers",
|
|
145963
|
+
"totalUsers",
|
|
145964
|
+
"activeUsers",
|
|
145965
|
+
"eventCount",
|
|
145966
|
+
"keyEvents",
|
|
145967
|
+
"bounceRate",
|
|
145968
|
+
"screenPageViews",
|
|
145969
|
+
"screenPageViewsPerUser",
|
|
145970
|
+
"averageSessionDuration"
|
|
145971
|
+
];
|
|
145972
|
+
var GA4_PATH = {
|
|
145973
|
+
overview: "AnalysisDataReportDataOverview",
|
|
145974
|
+
channels: "AnalysisDataReportSessionDefaultChannelGroup",
|
|
145975
|
+
pages: "AnalysisDataReportPagePath",
|
|
145976
|
+
report: "AnalysisDataReport"
|
|
145977
|
+
};
|
|
145978
|
+
var PRESET_DIMENSIONS = {
|
|
145979
|
+
overview: ["date"],
|
|
145980
|
+
channels: ["sessionDefaultChannelGroup"],
|
|
145981
|
+
pages: ["pagePath"]
|
|
145982
|
+
};
|
|
145983
|
+
function normalizeGa4PropertyId(raw) {
|
|
145984
|
+
const text5 = (raw ?? "").trim().replace(/^properties\//i, "");
|
|
145985
|
+
if (!/^\d+$/.test(text5)) {
|
|
145986
|
+
throw new Error(`--property \u987B\u4E3A GA4 \u6570\u5B57\u8D44\u6E90 ID\uFF0C\u6536\u5230\u300C${raw ?? ""}\u300D`);
|
|
145987
|
+
}
|
|
145988
|
+
return text5;
|
|
145989
|
+
}
|
|
145990
|
+
function parseIsoDate2(raw, label2) {
|
|
145991
|
+
const value = (raw ?? "").trim();
|
|
145992
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
145993
|
+
throw new Error(`${label2} \u987B\u4E3A YYYY-MM-DD\uFF0C\u6536\u5230\u300C${raw ?? ""}\u300D`);
|
|
145994
|
+
}
|
|
145995
|
+
const [year, month, day] = value.split("-").map((part) => Number(part));
|
|
145996
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
145997
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
|
|
145998
|
+
throw new Error(`${label2} \u4E0D\u662F\u6709\u6548\u65E5\u671F\uFF1A${value}`);
|
|
145999
|
+
}
|
|
146000
|
+
return value;
|
|
146001
|
+
}
|
|
146002
|
+
function parseGa4FieldList(raw, allow, kind) {
|
|
146003
|
+
const names = (raw ?? "").split(",").map((part) => part.trim()).filter(Boolean);
|
|
146004
|
+
if (names.length === 0) {
|
|
146005
|
+
throw new Error(`--${kind === "\u7EF4\u5EA6" ? "dimensions" : "metrics"} \u4E0D\u80FD\u4E3A\u7A7A\u3002\u5141\u8BB8\uFF1A${allow.join(", ")}`);
|
|
146006
|
+
}
|
|
146007
|
+
const allowed = new Set(allow);
|
|
146008
|
+
const seen = /* @__PURE__ */ new Set();
|
|
146009
|
+
for (const name2 of names) {
|
|
146010
|
+
if (!allowed.has(name2)) {
|
|
146011
|
+
throw new Error(`\u4E0D\u652F\u6301\u7684${kind}\u300C${name2}\u300D\u3002\u5141\u8BB8\uFF1A${allow.join(", ")}`);
|
|
146012
|
+
}
|
|
146013
|
+
if (seen.has(name2)) {
|
|
146014
|
+
throw new Error(`${kind}\u300C${name2}\u300D\u91CD\u590D`);
|
|
146015
|
+
}
|
|
146016
|
+
seen.add(name2);
|
|
146017
|
+
}
|
|
146018
|
+
return names;
|
|
146019
|
+
}
|
|
146020
|
+
function buildGa4ReportUrl(googleApiUrl, kind, input) {
|
|
146021
|
+
const account = input.account.trim();
|
|
146022
|
+
if (!account) {
|
|
146023
|
+
throw new Error("\u9700\u8981 --account\uFF1A\u5DF2\u7ED1\u5B9A\u7684 GoogleGA4 \u5A92\u4F53\u8D26\u53F7\uFF0C\u4E0D\u662F\u5E7F\u544A\u5BA2\u6237 ID");
|
|
146024
|
+
}
|
|
146025
|
+
const propertyId = normalizeGa4PropertyId(input.property);
|
|
146026
|
+
const startDate = parseIsoDate2(input.start, "--start");
|
|
146027
|
+
const endDate = parseIsoDate2(input.end, "--end");
|
|
146028
|
+
if (startDate > endDate) {
|
|
146029
|
+
throw new Error("--start \u4E0D\u80FD\u665A\u4E8E --end");
|
|
146030
|
+
}
|
|
146031
|
+
const dimensions = kind === "report" ? parseGa4FieldList(input.dimensions, GA4_REPORT_DIMENSIONS, "\u7EF4\u5EA6") : [...PRESET_DIMENSIONS[kind]];
|
|
146032
|
+
const metrics = kind === "report" ? parseGa4FieldList(input.metrics, GA4_REPORT_METRICS, "\u6307\u6807") : [];
|
|
146033
|
+
const params = new URLSearchParams();
|
|
146034
|
+
params.set("mediaAccountId", account);
|
|
146035
|
+
params.set("propertyId", propertyId);
|
|
146036
|
+
params.set("startDate", startDate);
|
|
146037
|
+
params.set("endDate", endDate);
|
|
146038
|
+
if (kind === "report") {
|
|
146039
|
+
params.set("dimensions", dimensions.join(","));
|
|
146040
|
+
params.set("metrics", metrics.join(","));
|
|
146041
|
+
}
|
|
146042
|
+
const base2 = googleApiUrl.replace(/\/+$/, "");
|
|
146043
|
+
return {
|
|
146044
|
+
url: `${base2}/analysisreporting/media-account/${GA4_PATH[kind]}?${params.toString()}`,
|
|
146045
|
+
query: { propertyId, startDate, endDate, dimensions, metrics }
|
|
146046
|
+
};
|
|
146047
|
+
}
|
|
146048
|
+
function cellValue(cell5) {
|
|
146049
|
+
return cell5?.value ?? cell5?.Value ?? "";
|
|
146050
|
+
}
|
|
146051
|
+
function periodRows(period) {
|
|
146052
|
+
if (!period) return [];
|
|
146053
|
+
return period.analyticsDataInfos ?? period.AnalyticsDataInfos ?? [];
|
|
146054
|
+
}
|
|
146055
|
+
function isPlaceholder(row, dimensionNames) {
|
|
146056
|
+
const dimensions = row.dimension ?? row.Dimension ?? [];
|
|
146057
|
+
const metrics = row.mtricInfos ?? row.MtricInfos ?? [];
|
|
146058
|
+
if (dimensions.length === 0 || dimensions.length !== dimensionNames.length) return false;
|
|
146059
|
+
const dimensionsMatch = dimensions.every((cell5, index) => cellValue(cell5) === dimensionNames[index]);
|
|
146060
|
+
const metricsMatch = metrics.every((cell5) => {
|
|
146061
|
+
const name2 = cell5.metric ?? cell5.Metric ?? "";
|
|
146062
|
+
return name2 !== "" && cellValue(cell5) === name2;
|
|
146063
|
+
});
|
|
146064
|
+
return dimensionsMatch && metricsMatch;
|
|
146065
|
+
}
|
|
146066
|
+
function flattenGa4Rows(period, dimensionNames) {
|
|
146067
|
+
const rows = [];
|
|
146068
|
+
for (const info of periodRows(period)) {
|
|
146069
|
+
if (isPlaceholder(info, dimensionNames)) continue;
|
|
146070
|
+
const record2 = {};
|
|
146071
|
+
const dimensions = info.dimension ?? info.Dimension ?? [];
|
|
146072
|
+
dimensionNames.forEach((name2, index) => {
|
|
146073
|
+
record2[name2] = cellValue(dimensions[index]);
|
|
146074
|
+
});
|
|
146075
|
+
for (const metric of info.mtricInfos ?? info.MtricInfos ?? []) {
|
|
146076
|
+
const name2 = metric.metric ?? metric.Metric;
|
|
146077
|
+
if (name2) record2[name2] = cellValue(metric);
|
|
146078
|
+
}
|
|
146079
|
+
rows.push(record2);
|
|
146080
|
+
}
|
|
146081
|
+
return rows;
|
|
146082
|
+
}
|
|
146083
|
+
function readEnvelope2(data) {
|
|
146084
|
+
return {
|
|
146085
|
+
current: data.analyticsDataReport ?? data.AnalyticsDataReport,
|
|
146086
|
+
previous: data.lastAnalyticsDataReport ?? data.LastAnalyticsDataReport
|
|
146087
|
+
};
|
|
146088
|
+
}
|
|
146089
|
+
function printPeriod(title, rows, dimensionNames) {
|
|
146090
|
+
console.log(`
|
|
146091
|
+
${title}\uFF08${rows.length} \u884C\uFF09`);
|
|
146092
|
+
if (rows.length === 0) {
|
|
146093
|
+
console.log(" \u6CA1\u6709\u6570\u636E\u884C\u3002\n");
|
|
146094
|
+
return;
|
|
146095
|
+
}
|
|
146096
|
+
const metricNames = [];
|
|
146097
|
+
for (const row of rows) {
|
|
146098
|
+
for (const key of Object.keys(row)) {
|
|
146099
|
+
if (!dimensionNames.includes(key) && !metricNames.includes(key)) metricNames.push(key);
|
|
146100
|
+
}
|
|
146101
|
+
}
|
|
146102
|
+
printCliTable(
|
|
146103
|
+
rows,
|
|
146104
|
+
[...dimensionNames, ...metricNames].map((key) => ({ key, header: key }))
|
|
146105
|
+
);
|
|
146106
|
+
}
|
|
146107
|
+
async function runGa4(opts) {
|
|
146108
|
+
let built;
|
|
146109
|
+
try {
|
|
146110
|
+
const config = loadConfig(opts.token);
|
|
146111
|
+
built = buildGa4ReportUrl(requireGoogleApi(config), opts.kind, opts);
|
|
146112
|
+
const data = await apiFetch2(built.url, config, { method: "GET" }, opts.verbose);
|
|
146113
|
+
const { current, previous } = readEnvelope2(data ?? {});
|
|
146114
|
+
const dimensions = built.query.dimensions;
|
|
146115
|
+
const rows = flattenGa4Rows(current, dimensions);
|
|
146116
|
+
const previousRows = flattenGa4Rows(previous, dimensions);
|
|
146117
|
+
const payload = {
|
|
146118
|
+
account: opts.account.trim(),
|
|
146119
|
+
propertyId: built.query.propertyId,
|
|
146120
|
+
startDate: built.query.startDate,
|
|
146121
|
+
endDate: built.query.endDate,
|
|
146122
|
+
dimensions,
|
|
146123
|
+
rows,
|
|
146124
|
+
previousRows
|
|
146125
|
+
};
|
|
146126
|
+
if (await emitCliJsonOrSnapshot(opts, {
|
|
146127
|
+
section: `ga4-${opts.kind}`,
|
|
146128
|
+
commandLabel: `ga4 ${opts.kind}`,
|
|
146129
|
+
payload,
|
|
146130
|
+
summaryExtras: { rows: rows.length, previousRows: previousRows.length }
|
|
146131
|
+
})) {
|
|
146132
|
+
return;
|
|
146133
|
+
}
|
|
146134
|
+
console.log(
|
|
146135
|
+
`GA4 ${opts.kind} property=${built.query.propertyId} ${built.query.startDate} ~ ${built.query.endDate}`
|
|
146136
|
+
);
|
|
146137
|
+
console.log("\u6307\u6807\u4FDD\u6301 GA4 \u539F\u503C\u3002\u4E0A\u4E00\u5468\u671F\u7531\u7F51\u5173\u6309\u7B49\u957F\u533A\u95F4\u81EA\u52A8\u67E5\u8BE2\u3002");
|
|
146138
|
+
printPeriod("\u672C\u671F", rows, dimensions);
|
|
146139
|
+
printPeriod("\u4E0A\u4E00\u5468\u671F", previousRows, dimensions);
|
|
146140
|
+
} catch (err) {
|
|
146141
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
146142
|
+
console.error(`
|
|
146143
|
+
\u274C GA4 \u62A5\u8868\u5931\u8D25\uFF1A${message}
|
|
146144
|
+
`);
|
|
146145
|
+
if (opts.verbose && err instanceof Error && err.stack) console.error(err.stack);
|
|
146146
|
+
process.exit(1);
|
|
146147
|
+
}
|
|
146148
|
+
}
|
|
146149
|
+
function addGa4QueryOptions(cmd) {
|
|
146150
|
+
attachJsonOutOption(cmd);
|
|
146151
|
+
return cmd.requiredOption("--account <id>", "\u5DF2\u7ED1\u5B9A\u7684 GoogleGA4 \u5A92\u4F53\u8D26\u53F7\u3002\u7528\u6765\u53D6\u6388\u6743\uFF0C\u4E0D\u662F\u5E7F\u544A\u5BA2\u6237 ID").requiredOption("--property <id>", "GA4 \u6570\u5B57\u8D44\u6E90 ID\uFF0C\u4F8B\u5982 123456789").requiredOption("--start <date>", "\u5F00\u59CB\u65E5\u671F YYYY-MM-DD").requiredOption("--end <date>", "\u7ED3\u675F\u65E5\u671F YYYY-MM-DD").option("--verbose", "\u8F93\u51FA\u8BE6\u7EC6\u9519\u8BEF\u5806\u6808").option("--token <jwt>", "\u4E34\u65F6\u4F7F\u7528\u7684 JWT Token\uFF08\u8986\u76D6 ~/.siluzan/config.json\uFF09");
|
|
146152
|
+
}
|
|
146153
|
+
function register28(program2) {
|
|
146154
|
+
const ga4 = program2.command("ga4").description("GA4 \u53EA\u8BFB\u6307\u6807\uFF08\u4F1A\u8BDD\u3001\u7528\u6237\u3001\u4E8B\u4EF6\u3001\u6E20\u9053\u3001\u9875\u9762\uFF09\u3002\u8D26\u53F7\u662F\u5DF2\u7ED1\u5B9A\u7684 GoogleGA4\uFF0C\u4E0D\u662F\u5E7F\u544A\u5BA2\u6237 ID");
|
|
146155
|
+
addGa4QueryOptions(
|
|
146156
|
+
ga4.command("overview").description("\u6309\u65E5\u7684\u4F1A\u8BDD\u3001\u7528\u6237\u3001\u4E8B\u4EF6\u3001\u5173\u952E\u4E8B\u4EF6\u3001\u8DF3\u51FA\u7387\u548C\u505C\u7559\u65F6\u957F\uFF0C\u542B\u4E0A\u4E00\u5468\u671F")
|
|
146157
|
+
).action(async (opts) => {
|
|
146158
|
+
await runGa4({ ...opts, kind: "overview" });
|
|
146159
|
+
});
|
|
146160
|
+
addGa4QueryOptions(
|
|
146161
|
+
ga4.command("channels").description("\u6309\u9ED8\u8BA4\u6E20\u9053\u5206\u7EC4\u7684\u4F1A\u8BDD\u548C\u4E8B\u4EF6\uFF0C\u542B\u4E0A\u4E00\u5468\u671F")
|
|
146162
|
+
).action(async (opts) => {
|
|
146163
|
+
await runGa4({ ...opts, kind: "channels" });
|
|
146164
|
+
});
|
|
146165
|
+
addGa4QueryOptions(
|
|
146166
|
+
ga4.command("pages").description("\u6309\u9875\u9762\u8DEF\u5F84\u7684\u4F1A\u8BDD\u548C\u4E8B\u4EF6\uFF0C\u542B\u4E0A\u4E00\u5468\u671F")
|
|
146167
|
+
).action(async (opts) => {
|
|
146168
|
+
await runGa4({ ...opts, kind: "pages" });
|
|
146169
|
+
});
|
|
146170
|
+
addGa4QueryOptions(
|
|
146171
|
+
ga4.command("report").description("\u6309\u767D\u540D\u5355\u91CC\u7684\u7EF4\u5EA6\u548C\u6307\u6807\u67E5 GA4\u3002\u4E8B\u4EF6\u793A\u4F8B\uFF1A--dimensions eventName --metrics eventCount,keyEvents")
|
|
146172
|
+
).requiredOption("--dimensions <names>", `\u7EF4\u5EA6\uFF0C\u9017\u53F7\u5206\u9694\u3002\u5141\u8BB8\uFF1A${GA4_REPORT_DIMENSIONS.join(", ")}`).requiredOption("--metrics <names>", `\u6307\u6807\uFF0C\u9017\u53F7\u5206\u9694\u3002\u5141\u8BB8\uFF1A${GA4_REPORT_METRICS.join(", ")}`).action(async (opts) => {
|
|
146173
|
+
await runGa4({ ...opts, kind: "report" });
|
|
146174
|
+
});
|
|
146175
|
+
}
|
|
146176
|
+
|
|
145817
146177
|
// src/index.ts
|
|
145818
146178
|
init_google_analysis3();
|
|
145819
146179
|
init_google_analysis_batch();
|
|
@@ -146737,12 +147097,12 @@ var TEMPLATE_BASENAMES2 = {
|
|
|
146737
147097
|
html: "meta-period-report.html"
|
|
146738
147098
|
};
|
|
146739
147099
|
var INJECT_MARKER2 = "window.__META_PERIOD_REPORT__ = window.__META_PERIOD_REPORT__ || null;";
|
|
146740
|
-
function resolveSkillTemplatePath5(
|
|
147100
|
+
function resolveSkillTemplatePath5(basename15) {
|
|
146741
147101
|
const dir = path47.dirname(fileURLToPath11(import.meta.url));
|
|
146742
147102
|
const candidates = [
|
|
146743
|
-
path47.join(dir, "skill", "report-templates",
|
|
146744
|
-
path47.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
146745
|
-
path47.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
147103
|
+
path47.join(dir, "skill", "report-templates", basename15),
|
|
147104
|
+
path47.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
147105
|
+
path47.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
146746
147106
|
];
|
|
146747
147107
|
for (const p of candidates) {
|
|
146748
147108
|
if (fs40.existsSync(p)) return p;
|
|
@@ -147217,12 +147577,12 @@ init_lang();
|
|
|
147217
147577
|
init_html();
|
|
147218
147578
|
var TEMPLATE_BASENAME3 = "meta-account-diagnosis-report.html";
|
|
147219
147579
|
var INJECT_MARKER3 = "window.__META_DIAGNOSIS_REPORT__ = window.__META_DIAGNOSIS_REPORT__ || null;";
|
|
147220
|
-
function resolveSkillTemplatePath6(
|
|
147580
|
+
function resolveSkillTemplatePath6(basename15) {
|
|
147221
147581
|
const dir = path49.dirname(fileURLToPath12(import.meta.url));
|
|
147222
147582
|
const candidates = [
|
|
147223
|
-
path49.join(dir, "skill", "report-templates",
|
|
147224
|
-
path49.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
147225
|
-
path49.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
147583
|
+
path49.join(dir, "skill", "report-templates", basename15),
|
|
147584
|
+
path49.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
147585
|
+
path49.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
147226
147586
|
];
|
|
147227
147587
|
for (const p of candidates) {
|
|
147228
147588
|
if (fs42.existsSync(p)) return p;
|
|
@@ -149355,12 +149715,12 @@ init_lang();
|
|
|
149355
149715
|
init_html();
|
|
149356
149716
|
var TEMPLATE_BASENAME4 = "bing-period-report.html";
|
|
149357
149717
|
var INJECT_MARKER4 = "window.__BING_PERIOD_REPORT__ = window.__BING_PERIOD_REPORT__ || null;";
|
|
149358
|
-
function resolveSkillTemplatePath7(
|
|
149718
|
+
function resolveSkillTemplatePath7(basename15) {
|
|
149359
149719
|
const dir = path53.dirname(fileURLToPath13(import.meta.url));
|
|
149360
149720
|
const candidates = [
|
|
149361
|
-
path53.join(dir, "skill", "report-templates",
|
|
149362
|
-
path53.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
149363
|
-
path53.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
149721
|
+
path53.join(dir, "skill", "report-templates", basename15),
|
|
149722
|
+
path53.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
149723
|
+
path53.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
149364
149724
|
];
|
|
149365
149725
|
for (const p of candidates) {
|
|
149366
149726
|
if (fs44.existsSync(p)) return p;
|
|
@@ -150370,12 +150730,12 @@ init_lang();
|
|
|
150370
150730
|
init_html();
|
|
150371
150731
|
var TEMPLATE_BASENAME5 = "tiktok-period-report.html";
|
|
150372
150732
|
var INJECT_MARKER5 = "window.__TIKTOK_PERIOD_REPORT__ = window.__TIKTOK_PERIOD_REPORT__ || null;";
|
|
150373
|
-
function resolveSkillTemplatePath8(
|
|
150733
|
+
function resolveSkillTemplatePath8(basename15) {
|
|
150374
150734
|
const dir = path56.dirname(fileURLToPath14(import.meta.url));
|
|
150375
150735
|
const candidates = [
|
|
150376
|
-
path56.join(dir, "skill", "report-templates",
|
|
150377
|
-
path56.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
150378
|
-
path56.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
150736
|
+
path56.join(dir, "skill", "report-templates", basename15),
|
|
150737
|
+
path56.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
150738
|
+
path56.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
150379
150739
|
];
|
|
150380
150740
|
for (const p of candidates) {
|
|
150381
150741
|
if (fs46.existsSync(p)) return p;
|
|
@@ -150623,6 +150983,29 @@ function daysInclusive(start, end) {
|
|
|
150623
150983
|
const b = new Date(end.getFullYear(), end.getMonth(), end.getDate());
|
|
150624
150984
|
return Math.floor((b.getTime() - a.getTime()) / 864e5) + 1;
|
|
150625
150985
|
}
|
|
150986
|
+
var REPORT_LEVEL_ID = {
|
|
150987
|
+
AUCTION_ADVERTISER: "",
|
|
150988
|
+
AUCTION_CAMPAIGN: "campaign_id",
|
|
150989
|
+
AUCTION_ADGROUP: "adgroup_id",
|
|
150990
|
+
AUCTION_AD: "ad_id"
|
|
150991
|
+
};
|
|
150992
|
+
var REPORT_ENTITY_IDS = ["campaign_id", "adgroup_id", "ad_id"];
|
|
150993
|
+
function tiktokReportDimensionError(dataLevel, dimensions) {
|
|
150994
|
+
const level = dataLevel.trim();
|
|
150995
|
+
if (!Object.prototype.hasOwnProperty.call(REPORT_LEVEL_ID, level)) {
|
|
150996
|
+
return "data-level \u53EA\u63A5\u53D7 AUCTION_ADVERTISER\u3001AUCTION_CAMPAIGN\u3001AUCTION_ADGROUP\u3001AUCTION_AD";
|
|
150997
|
+
}
|
|
150998
|
+
const dims = dimensions.split(",").map((item) => item.trim()).filter(Boolean);
|
|
150999
|
+
const own = REPORT_LEVEL_ID[level] ?? "";
|
|
151000
|
+
if (own && !dims.includes(own)) {
|
|
151001
|
+
return `${level} \u7684 dimensions \u5FC5\u987B\u5305\u542B ${own}`;
|
|
151002
|
+
}
|
|
151003
|
+
const extra = REPORT_ENTITY_IDS.filter((name2) => name2 !== own && dims.includes(name2));
|
|
151004
|
+
if (extra.length > 0) {
|
|
151005
|
+
return own ? `${level} \u4E0D\u80FD\u5E26 ${extra.join("\u3001")}` : "AUCTION_ADVERTISER \u4E0D\u80FD\u5E26 campaign_id\u3001adgroup_id \u6216 ad_id";
|
|
151006
|
+
}
|
|
151007
|
+
return void 0;
|
|
151008
|
+
}
|
|
150626
151009
|
function assertTikTokOfficialReportRange(startDate, endDate, dimensions) {
|
|
150627
151010
|
const start = startDate.trim();
|
|
150628
151011
|
const end = endDate.trim();
|
|
@@ -150668,7 +151051,8 @@ function unwrapTikTokEnvelope(raw, label2) {
|
|
|
150668
151051
|
if (code !== 0 && code !== void 0) {
|
|
150669
151052
|
throw new Error(`${label2} \u4E1A\u52A1\u5931\u8D25 code=${code}\uFF1A${env.message ?? "\u672A\u77E5\u9519\u8BEF"}`);
|
|
150670
151053
|
}
|
|
150671
|
-
const
|
|
151054
|
+
const data = env.data;
|
|
151055
|
+
const list = Array.isArray(data?.list) ? data.list : Array.isArray(data?.pixels) ? data.pixels : [];
|
|
150672
151056
|
const info = env.data?.page_info ?? {};
|
|
150673
151057
|
const page = parseTikTokNumber(info.page) ?? 1;
|
|
150674
151058
|
const pageSize = parseTikTokNumber(info.page_size) ?? list.length;
|
|
@@ -151073,6 +151457,13 @@ async function runTikTokOfficialReport(opts) {
|
|
|
151073
151457
|
console.error("\n\u274C --data-level / --dimensions / --metrics \u5747\u4E3A\u5FC5\u586B\u3002\n");
|
|
151074
151458
|
process.exit(1);
|
|
151075
151459
|
}
|
|
151460
|
+
const dimensionError = tiktokReportDimensionError(dataLevel, dimensions);
|
|
151461
|
+
if (dimensionError) {
|
|
151462
|
+
console.error(`
|
|
151463
|
+
\u274C ${dimensionError}
|
|
151464
|
+
`);
|
|
151465
|
+
process.exit(1);
|
|
151466
|
+
}
|
|
151076
151467
|
const { startDate, endDate } = assertTikTokOfficialReportRange(opts.start, opts.end, dimensions);
|
|
151077
151468
|
const serviceType = (opts.serviceType ?? "AUCTION").trim() || "AUCTION";
|
|
151078
151469
|
const pageSize = resolveTikTokPageSize(opts.pageSize, TIKTOK_REPORT_PAGE_SIZE_DEFAULT);
|
|
@@ -151316,12 +151707,700 @@ async function runTikTokAdStatus(opts) {
|
|
|
151316
151707
|
);
|
|
151317
151708
|
}
|
|
151318
151709
|
|
|
151319
|
-
// src/commands/tiktok-analysis/
|
|
151710
|
+
// src/commands/tiktok-analysis/media-run.ts
|
|
151711
|
+
init_dist();
|
|
151712
|
+
init_auth();
|
|
151713
|
+
init_cli_json_snapshot();
|
|
151714
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
151715
|
+
import { basename as basename14 } from "path";
|
|
151716
|
+
init_cli_table();
|
|
151717
|
+
|
|
151718
|
+
// src/commands/tiktok-analysis/media.ts
|
|
151719
|
+
var TIKTOK_IDENTITY_TYPES = [
|
|
151720
|
+
"CUSTOMIZED_USER",
|
|
151721
|
+
"AUTH_CODE",
|
|
151722
|
+
"TT_USER",
|
|
151723
|
+
"BC_AUTH_TT"
|
|
151724
|
+
];
|
|
151725
|
+
var PIXEL_PAGE_SIZE_MAX = 20;
|
|
151726
|
+
var LIST_PAGE_SIZE_DEFAULT = 100;
|
|
151727
|
+
function assertHttpsAssetUrl(raw, label2) {
|
|
151728
|
+
const text5 = (raw ?? "").trim();
|
|
151729
|
+
let parsed;
|
|
151730
|
+
try {
|
|
151731
|
+
parsed = new URL(text5);
|
|
151732
|
+
} catch {
|
|
151733
|
+
throw new Error(`${label2} \u5FC5\u987B\u662F https \u5730\u5740\u3002\u7F51\u5173\u4E0D\u63A5\u6536\u672C\u5730\u6587\u4EF6`);
|
|
151734
|
+
}
|
|
151735
|
+
if (parsed.protocol !== "https:") {
|
|
151736
|
+
throw new Error(`${label2} \u5FC5\u987B\u662F https \u5730\u5740\u3002\u7F51\u5173\u4E0D\u63A5\u6536\u672C\u5730\u6587\u4EF6`);
|
|
151737
|
+
}
|
|
151738
|
+
return text5;
|
|
151739
|
+
}
|
|
151740
|
+
function imageUploadBody(advertiserId, imageUrl) {
|
|
151741
|
+
return {
|
|
151742
|
+
advertiser_id: advertiserId,
|
|
151743
|
+
upload_type: "UPLOAD_BY_URL",
|
|
151744
|
+
image_url: assertHttpsAssetUrl(imageUrl, "\u56FE\u7247\u5730\u5740")
|
|
151745
|
+
};
|
|
151746
|
+
}
|
|
151747
|
+
function imageUploadPath(account) {
|
|
151748
|
+
return `tiktokadmanagement/ad/UploadImage/${TIKTOK_MEDIA_TYPE}/${encodeURIComponent(account)}`;
|
|
151749
|
+
}
|
|
151750
|
+
function videoUploadBody(advertiserId, videoUrl, fileName) {
|
|
151751
|
+
const name2 = fileName?.trim();
|
|
151752
|
+
return {
|
|
151753
|
+
advertiser_id: advertiserId,
|
|
151754
|
+
upload_type: "UPLOAD_BY_URL",
|
|
151755
|
+
video_url: assertHttpsAssetUrl(videoUrl, "\u89C6\u9891\u5730\u5740"),
|
|
151756
|
+
...name2 ? { file_name: name2 } : {},
|
|
151757
|
+
flaw_detect: false,
|
|
151758
|
+
auto_fix_enabled: false,
|
|
151759
|
+
auto_bind_enabled: false
|
|
151760
|
+
};
|
|
151761
|
+
}
|
|
151762
|
+
function videoUploadPath() {
|
|
151763
|
+
return `tiktokadmanagement/ad/UploadVideo/${TIKTOK_MEDIA_TYPE}`;
|
|
151764
|
+
}
|
|
151765
|
+
function videoUploadByUrlBody(advertiserId, videoUrl, videoName) {
|
|
151766
|
+
const name2 = videoName?.trim();
|
|
151767
|
+
return {
|
|
151768
|
+
MediaCustomerId: advertiserId,
|
|
151769
|
+
VideoUrl: assertHttpsAssetUrl(videoUrl, "\u89C6\u9891\u5730\u5740"),
|
|
151770
|
+
...name2 ? { VideoName: name2 } : {}
|
|
151771
|
+
};
|
|
151772
|
+
}
|
|
151773
|
+
function videoUploadByUrlPath() {
|
|
151774
|
+
return `tiktokadmanagement/ad/UploadVideoByUrl/${TIKTOK_MEDIA_TYPE}`;
|
|
151775
|
+
}
|
|
151776
|
+
function videoInfoQuery(account, videoIds, materialIds) {
|
|
151777
|
+
const videos = splitIds(videoIds, "video-ids");
|
|
151778
|
+
const materials = splitIds(materialIds, "material-ids");
|
|
151779
|
+
if (videos.length === 0 && materials.length === 0) {
|
|
151780
|
+
throw new Error("video-info \u8981 --video-ids \u6216 --material-ids");
|
|
151781
|
+
}
|
|
151782
|
+
const q = new URLSearchParams({ mediacustomerId: account });
|
|
151783
|
+
if (videos.length > 0) q.set("videoIds", videos.join(","));
|
|
151784
|
+
if (materials.length > 0) q.set("material_ids", materials.join(","));
|
|
151785
|
+
return `tiktokadmanagement/ad/getvideoinfo/${TIKTOK_MEDIA_TYPE}?${q}`;
|
|
151786
|
+
}
|
|
151787
|
+
function parseIdentityType(raw) {
|
|
151788
|
+
const text5 = (raw ?? "").trim();
|
|
151789
|
+
if (!text5) return void 0;
|
|
151790
|
+
const value = text5.toUpperCase();
|
|
151791
|
+
if (!TIKTOK_IDENTITY_TYPES.includes(value)) {
|
|
151792
|
+
throw new Error(`identity-type \u53EA\u63A5\u53D7 ${TIKTOK_IDENTITY_TYPES.join(" / ")}`);
|
|
151793
|
+
}
|
|
151794
|
+
return value;
|
|
151795
|
+
}
|
|
151796
|
+
function identityListPath(account, pageNum, pageSize, identityType) {
|
|
151797
|
+
const q = new URLSearchParams({
|
|
151798
|
+
mediacustomerId: account,
|
|
151799
|
+
pageNum: String(pageNum),
|
|
151800
|
+
pageSize: String(pageSize)
|
|
151801
|
+
});
|
|
151802
|
+
const type = parseIdentityType(identityType);
|
|
151803
|
+
if (type) q.set("IdentityType", type);
|
|
151804
|
+
return `tiktokadmanagement/ad/${TIKTOK_MEDIA_TYPE}/GetIdentityIdList?${q}`;
|
|
151805
|
+
}
|
|
151806
|
+
function identityCreateBody(advertiserId, displayName, imageUri) {
|
|
151807
|
+
const display_name = (displayName ?? "").trim();
|
|
151808
|
+
const image_uri = (imageUri ?? "").trim();
|
|
151809
|
+
if (!display_name) throw new Error("display-name \u4E0D\u80FD\u4E3A\u7A7A");
|
|
151810
|
+
if (!image_uri) {
|
|
151811
|
+
throw new Error("image-uri \u4E0D\u80FD\u4E3A\u7A7A\u3002\u5148 image-upload\uFF0C\u7528\u8FD4\u56DE\u7684 image_id");
|
|
151812
|
+
}
|
|
151813
|
+
return { advertiser_id: advertiserId, display_name, image_uri };
|
|
151814
|
+
}
|
|
151815
|
+
function identityCreatePath() {
|
|
151816
|
+
return `tiktokadmanagement/ad/CreateIdentity/${TIKTOK_MEDIA_TYPE}`;
|
|
151817
|
+
}
|
|
151818
|
+
function audienceListPath(account, pageNum, pageSize, audienceIds) {
|
|
151819
|
+
const q = new URLSearchParams({
|
|
151820
|
+
mediacustomerId: account,
|
|
151821
|
+
pageNum: String(pageNum),
|
|
151822
|
+
pageSize: String(pageSize)
|
|
151823
|
+
});
|
|
151824
|
+
const ids = splitIds(audienceIds, "audience-ids");
|
|
151825
|
+
if (ids.length > 0) q.set("customAudienceIds", ids.join(","));
|
|
151826
|
+
return `tiktokadgroupmanagement/adgroup/${TIKTOK_MEDIA_TYPE}/GetCustomAudienceList?${q}`;
|
|
151827
|
+
}
|
|
151828
|
+
function pixelListPath(account, pageNum, pageSize, filter) {
|
|
151829
|
+
const q = new URLSearchParams({
|
|
151830
|
+
mediacustomerId: account,
|
|
151831
|
+
pageNum: String(pageNum),
|
|
151832
|
+
pageSize: String(pageSize)
|
|
151833
|
+
});
|
|
151834
|
+
const code = filter?.code?.trim();
|
|
151835
|
+
const pixelId = filter?.pixelId?.trim();
|
|
151836
|
+
const name2 = filter?.name?.trim();
|
|
151837
|
+
if (code) q.set("code", code);
|
|
151838
|
+
if (pixelId) q.set("pixelId", pixelId);
|
|
151839
|
+
if (name2) q.set("name", name2);
|
|
151840
|
+
return `tiktokadgroupmanagement/adgroup/${TIKTOK_MEDIA_TYPE}/GetPixelList?${q}`;
|
|
151841
|
+
}
|
|
151842
|
+
function pixelCreateBody(advertiserId, name2, category) {
|
|
151843
|
+
const pixel_name = (name2 ?? "").trim();
|
|
151844
|
+
const pixel_category = (category ?? "").trim();
|
|
151845
|
+
if (!pixel_name || pixel_name.length > 40) {
|
|
151846
|
+
throw new Error("\u50CF\u7D20\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u4E14\u4E0D\u8D85\u8FC7 40 \u4E2A\u5B57\u7B26");
|
|
151847
|
+
}
|
|
151848
|
+
if (!pixel_category) throw new Error("pixel-category \u4E0D\u80FD\u4E3A\u7A7A");
|
|
151849
|
+
return { advertiser_id: advertiserId, pixel_name, pixel_category };
|
|
151850
|
+
}
|
|
151851
|
+
function pixelCreatePath(account) {
|
|
151852
|
+
return `tiktokadgroupmanagement/adgroup/CreatePixel/${TIKTOK_MEDIA_TYPE}/${encodeURIComponent(account)}`;
|
|
151853
|
+
}
|
|
151854
|
+
function parsePixelEvents(raw) {
|
|
151855
|
+
const text5 = (raw ?? "").trim();
|
|
151856
|
+
if (!text5) throw new Error("pixel \u4E8B\u4EF6\u9700\u8981 --events\uFF0C\u5185\u5BB9\u662F\u975E\u7A7A JSON \u6570\u7EC4");
|
|
151857
|
+
let parsed;
|
|
151858
|
+
try {
|
|
151859
|
+
parsed = JSON.parse(text5);
|
|
151860
|
+
} catch {
|
|
151861
|
+
throw new Error("pixel \u4E8B\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON");
|
|
151862
|
+
}
|
|
151863
|
+
if (!Array.isArray(parsed) || parsed.length < 1) {
|
|
151864
|
+
throw new Error("pixel \u4E8B\u4EF6\u5FC5\u987B\u662F\u975E\u7A7A JSON \u6570\u7EC4");
|
|
151865
|
+
}
|
|
151866
|
+
return parsed;
|
|
151867
|
+
}
|
|
151868
|
+
function pixelEventBody(advertiserId, pixelId, events) {
|
|
151869
|
+
const pixel_id = (pixelId ?? "").trim();
|
|
151870
|
+
if (!pixel_id) throw new Error("pixel-id \u4E0D\u80FD\u4E3A\u7A7A");
|
|
151871
|
+
if (events.length < 1) throw new Error("pixel \u4E8B\u4EF6\u5FC5\u987B\u662F\u975E\u7A7A JSON \u6570\u7EC4");
|
|
151872
|
+
return { advertiser_id: advertiserId, pixel_id, pixel_events: events };
|
|
151873
|
+
}
|
|
151874
|
+
function pixelEventPath() {
|
|
151875
|
+
return `tiktokadgroupmanagement/adgroup/CreatePixelEvent/${TIKTOK_MEDIA_TYPE}`;
|
|
151876
|
+
}
|
|
151877
|
+
function assertPixelStatsRange(start, end) {
|
|
151878
|
+
const startDate = start.trim();
|
|
151879
|
+
const endDate = end.trim();
|
|
151880
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(startDate) || !/^\d{4}-\d{2}-\d{2}$/.test(endDate)) {
|
|
151881
|
+
throw new Error("pixel \u7EDF\u8BA1\u7684 start / end \u987B\u662F YYYY-MM-DD");
|
|
151882
|
+
}
|
|
151883
|
+
const startMs = Date.parse(`${startDate}T00:00:00Z`);
|
|
151884
|
+
const endMs = Date.parse(`${endDate}T00:00:00Z`);
|
|
151885
|
+
if (Number.isNaN(startMs) || Number.isNaN(endMs) || endMs < startMs) {
|
|
151886
|
+
throw new Error("pixel \u7EDF\u8BA1\u7684 end \u4E0D\u80FD\u65E9\u4E8E start");
|
|
151887
|
+
}
|
|
151888
|
+
const days = Math.round((endMs - startMs) / 864e5);
|
|
151889
|
+
if (days > 30) throw new Error("pixel \u7EDF\u8BA1\u533A\u95F4\u8DE8\u5EA6\u5FC5\u987B \u2264 30 \u5929");
|
|
151890
|
+
return { start: startDate, end: endDate };
|
|
151891
|
+
}
|
|
151892
|
+
function pixelStatsPath(account, pixelIdsRaw, start, end) {
|
|
151893
|
+
const ids = splitIds(pixelIdsRaw, "pixel-ids");
|
|
151894
|
+
if (ids.length < 1 || ids.length > 10) {
|
|
151895
|
+
throw new Error("pixel-ids \u9700\u8981 1 \u5230 10 \u4E2A\u50CF\u7D20 ID");
|
|
151896
|
+
}
|
|
151897
|
+
const range = assertPixelStatsRange(start, end);
|
|
151898
|
+
const q = new URLSearchParams({
|
|
151899
|
+
advertiser_id: account,
|
|
151900
|
+
PixelIds: ids.join(","),
|
|
151901
|
+
"date_range.start_date": range.start,
|
|
151902
|
+
"date_range.end_date": range.end
|
|
151903
|
+
});
|
|
151904
|
+
return `tiktokadgroupmanagement/adgroup/GetPixelStats/${TIKTOK_MEDIA_TYPE}/${encodeURIComponent(account)}?${q}`;
|
|
151905
|
+
}
|
|
151906
|
+
function ctaPortfolioPath(account, contentType, assetType) {
|
|
151907
|
+
const content = (contentType ?? "").trim();
|
|
151908
|
+
const asset = (assetType ?? "").trim();
|
|
151909
|
+
if (!content || !asset) throw new Error("content-type \u548C asset-type \u90FD\u4E0D\u80FD\u4E3A\u7A7A");
|
|
151910
|
+
const q = new URLSearchParams({
|
|
151911
|
+
mediacustomerId: account,
|
|
151912
|
+
contentType: content,
|
|
151913
|
+
assetType: asset
|
|
151914
|
+
});
|
|
151915
|
+
return `tiktokadmanagement/ad/${TIKTOK_MEDIA_TYPE}/GetPortfolio?${q}`;
|
|
151916
|
+
}
|
|
151917
|
+
function smartTextBody(advertiserId, input) {
|
|
151918
|
+
const keywords = splitIds(input.keywords, "keywords");
|
|
151919
|
+
const adgroup_id = input.adgroupId?.trim();
|
|
151920
|
+
const industry_id = input.industryId?.trim();
|
|
151921
|
+
if (!adgroup_id) {
|
|
151922
|
+
throw new Error("\u667A\u80FD\u6587\u6848\u5FC5\u987B\u5E26 adgroup-id\uFF0C\u5B98\u65B9\u63A5\u53E3\u4E0D\u63A5\u53D7\u53EA\u6709\u5173\u952E\u8BCD\u6216\u884C\u4E1A\u7684\u8BF7\u6C42");
|
|
151923
|
+
}
|
|
151924
|
+
const language = input.language?.trim();
|
|
151925
|
+
const param_type = input.paramType?.trim();
|
|
151926
|
+
let limit;
|
|
151927
|
+
if (input.limit != null && input.limit.trim() !== "") {
|
|
151928
|
+
limit = Number(input.limit.trim());
|
|
151929
|
+
if (!Number.isInteger(limit) || limit <= 0) throw new Error("limit \u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6574\u6570");
|
|
151930
|
+
}
|
|
151931
|
+
return {
|
|
151932
|
+
advertiser_id: advertiserId,
|
|
151933
|
+
...adgroup_id ? { adgroup_id } : {},
|
|
151934
|
+
...param_type ? { param_type } : {},
|
|
151935
|
+
...language ? { language } : {},
|
|
151936
|
+
...industry_id ? { industry_id } : {},
|
|
151937
|
+
...keywords.length > 0 ? { keywords } : {},
|
|
151938
|
+
...limit != null ? { limit } : {}
|
|
151939
|
+
};
|
|
151940
|
+
}
|
|
151941
|
+
function smartTextPath() {
|
|
151942
|
+
return `tiktokadmanagement/ad/${TIKTOK_MEDIA_TYPE}/GetSmartText`;
|
|
151943
|
+
}
|
|
151944
|
+
function resolveMediaPageSize(raw, kind) {
|
|
151945
|
+
const fallback = kind === "pixel" ? PIXEL_PAGE_SIZE_MAX : LIST_PAGE_SIZE_DEFAULT;
|
|
151946
|
+
const size = resolveTikTokPageSize(raw, fallback);
|
|
151947
|
+
return kind === "pixel" ? Math.min(size, PIXEL_PAGE_SIZE_MAX) : size;
|
|
151948
|
+
}
|
|
151949
|
+
function splitIds(raw, label2) {
|
|
151950
|
+
if (raw == null || raw.trim() === "") return [];
|
|
151951
|
+
const ids = raw.split(",").map((part) => part.trim()).filter(Boolean);
|
|
151952
|
+
if (raw.trim() !== "" && ids.length === 0) {
|
|
151953
|
+
throw new Error(`${label2} \u4E0D\u80FD\u662F\u7A7A\u5217\u8868`);
|
|
151954
|
+
}
|
|
151955
|
+
return ids;
|
|
151956
|
+
}
|
|
151957
|
+
|
|
151958
|
+
// src/commands/tiktok-analysis/media-run.ts
|
|
151959
|
+
function fail8(label2, err) {
|
|
151960
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
151961
|
+
console.error(`
|
|
151962
|
+
\u274C ${label2}\uFF1A${msg}
|
|
151963
|
+
`);
|
|
151964
|
+
process.exit(1);
|
|
151965
|
+
}
|
|
151966
|
+
function assertBusinessOk(payload, label2) {
|
|
151967
|
+
if (!payload || typeof payload !== "object") return;
|
|
151968
|
+
const code = payload.code;
|
|
151969
|
+
if (code === void 0 || code === 0 || code === "0") return;
|
|
151970
|
+
const message = payload.message ?? "\u672A\u77E5\u9519\u8BEF";
|
|
151971
|
+
throw new Error(`${label2} \u4E1A\u52A1\u5931\u8D25 code=${String(code)}\uFF1A${message}`);
|
|
151972
|
+
}
|
|
151973
|
+
async function requestTikTok(method, path61, body, opts, section, commandLabel) {
|
|
151974
|
+
const advertiserId = assertTikTokAccountId(opts.account);
|
|
151975
|
+
const config = loadConfig(opts.token);
|
|
151976
|
+
const url = `${requireTikTokApiUrl(config)}/${path61}`;
|
|
151977
|
+
const payload = await apiFetch2(
|
|
151978
|
+
url,
|
|
151979
|
+
config,
|
|
151980
|
+
method === "POST" ? { method: "POST", body: JSON.stringify(body) } : {},
|
|
151981
|
+
opts.verbose
|
|
151982
|
+
);
|
|
151983
|
+
assertBusinessOk(payload, commandLabel);
|
|
151984
|
+
const emitted = await emitCliJsonOrSnapshot(
|
|
151985
|
+
{ jsonOut: opts.jsonOut },
|
|
151986
|
+
{ section, commandLabel, payload, idSuffix: advertiserId }
|
|
151987
|
+
);
|
|
151988
|
+
if (emitted) return;
|
|
151989
|
+
console.log(`
|
|
151990
|
+
\u2705 ${commandLabel}
|
|
151991
|
+
`);
|
|
151992
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
151993
|
+
console.log();
|
|
151994
|
+
}
|
|
151995
|
+
async function requestTikTokList(buildPath, opts, kind, section, commandLabel, columns) {
|
|
151996
|
+
const advertiserId = assertTikTokAccountId(opts.account);
|
|
151997
|
+
const config = loadConfig(opts.token);
|
|
151998
|
+
const base2 = requireTikTokApiUrl(config);
|
|
151999
|
+
const pageSize = resolveMediaPageSize(opts.pageSize, kind);
|
|
152000
|
+
let result;
|
|
152001
|
+
try {
|
|
152002
|
+
result = await fetchTikTokPagedList(
|
|
152003
|
+
config,
|
|
152004
|
+
(pageNum, size) => `${base2}/${buildPath(pageNum, size)}`,
|
|
152005
|
+
{ pageSize, verbose: !!opts.verbose, label: commandLabel }
|
|
152006
|
+
);
|
|
152007
|
+
} catch (err) {
|
|
152008
|
+
fail8(commandLabel, err);
|
|
152009
|
+
}
|
|
152010
|
+
const payload = wrapListJson({
|
|
152011
|
+
page: 1,
|
|
152012
|
+
pageSize,
|
|
152013
|
+
total: result.totalNumber,
|
|
152014
|
+
items: result.items
|
|
152015
|
+
});
|
|
152016
|
+
if (await emitCliJsonOrSnapshot(
|
|
152017
|
+
{ jsonOut: opts.jsonOut },
|
|
152018
|
+
{ section, commandLabel, payload, idSuffix: advertiserId }
|
|
152019
|
+
)) {
|
|
152020
|
+
return;
|
|
152021
|
+
}
|
|
152022
|
+
console.log(`
|
|
152023
|
+
${commandLabel}\uFF08${advertiserId}\uFF0C\u5171 ${result.totalNumber} \u6761\uFF09
|
|
152024
|
+
`);
|
|
152025
|
+
if (result.items.length === 0) {
|
|
152026
|
+
console.log(" \u6682\u65E0\u6570\u636E\u3002\n");
|
|
152027
|
+
return;
|
|
152028
|
+
}
|
|
152029
|
+
printCliTable(
|
|
152030
|
+
result.items.map((row) => {
|
|
152031
|
+
const out = {};
|
|
152032
|
+
for (const column of columns) out[column.key] = pick2(row, column.fields);
|
|
152033
|
+
return out;
|
|
152034
|
+
}),
|
|
152035
|
+
columns.map((column) => ({ key: column.key, header: column.header }))
|
|
152036
|
+
);
|
|
152037
|
+
}
|
|
152038
|
+
function pick2(row, fields) {
|
|
152039
|
+
for (const field6 of fields) {
|
|
152040
|
+
const value = row[field6];
|
|
152041
|
+
if (value != null && value !== "") return String(value);
|
|
152042
|
+
}
|
|
152043
|
+
return "";
|
|
152044
|
+
}
|
|
152045
|
+
function assertCtaCommit() {
|
|
152046
|
+
if (isWriteAuditCommitRequiredSatisfied()) return;
|
|
152047
|
+
console.error(
|
|
152048
|
+
'\n\u274C \u8FD9\u6761\u547D\u4EE4\u4F1A\u521B\u5EFA CTA \u7EC4\u5408\uFF0C\u5FC5\u987B\u63D0\u4F9B\u8BF4\u660E\uFF1A\u8BF7\u5728\u547D\u4EE4\u672B\u5C3E\u52A0 --commit "\u7B80\u77ED\u8BF4\u660E"\n'
|
|
152049
|
+
);
|
|
152050
|
+
process.exit(1);
|
|
152051
|
+
}
|
|
152052
|
+
async function runTikTokImageUpload(opts) {
|
|
152053
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152054
|
+
let body;
|
|
152055
|
+
try {
|
|
152056
|
+
body = imageUploadBody(account, opts.imageUrl);
|
|
152057
|
+
} catch (err) {
|
|
152058
|
+
fail8("\u4E0A\u4F20\u56FE\u7247\u5931\u8D25", err);
|
|
152059
|
+
}
|
|
152060
|
+
try {
|
|
152061
|
+
await requestTikTok("POST", imageUploadPath(account), body, opts, "tiktok-image-upload", "tiktok-analysis image-upload");
|
|
152062
|
+
} catch (err) {
|
|
152063
|
+
fail8("\u4E0A\u4F20\u56FE\u7247\u5931\u8D25", err);
|
|
152064
|
+
}
|
|
152065
|
+
}
|
|
152066
|
+
async function runTikTokVideoUpload(opts) {
|
|
152067
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152068
|
+
let body;
|
|
152069
|
+
try {
|
|
152070
|
+
body = videoUploadBody(account, opts.videoUrl, opts.name);
|
|
152071
|
+
} catch (err) {
|
|
152072
|
+
fail8("\u4E0A\u4F20\u89C6\u9891\u5931\u8D25", err);
|
|
152073
|
+
}
|
|
152074
|
+
try {
|
|
152075
|
+
await requestTikTok("POST", videoUploadPath(), body, opts, "tiktok-video-upload", "tiktok-analysis video-upload");
|
|
152076
|
+
} catch (err) {
|
|
152077
|
+
fail8("\u4E0A\u4F20\u89C6\u9891\u5931\u8D25", err);
|
|
152078
|
+
}
|
|
152079
|
+
}
|
|
152080
|
+
async function runTikTokVideoUploadByUrl(opts) {
|
|
152081
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152082
|
+
let body;
|
|
152083
|
+
try {
|
|
152084
|
+
body = videoUploadByUrlBody(account, opts.videoUrl, opts.name);
|
|
152085
|
+
} catch (err) {
|
|
152086
|
+
fail8("\u4E0A\u4F20\u89C6\u9891\u5931\u8D25", err);
|
|
152087
|
+
}
|
|
152088
|
+
try {
|
|
152089
|
+
await requestTikTok(
|
|
152090
|
+
"POST",
|
|
152091
|
+
videoUploadByUrlPath(),
|
|
152092
|
+
body,
|
|
152093
|
+
opts,
|
|
152094
|
+
"tiktok-video-upload-url",
|
|
152095
|
+
"tiktok-analysis video-upload-url"
|
|
152096
|
+
);
|
|
152097
|
+
} catch (err) {
|
|
152098
|
+
fail8("\u4E0A\u4F20\u89C6\u9891\u5931\u8D25", err);
|
|
152099
|
+
}
|
|
152100
|
+
}
|
|
152101
|
+
async function runTikTokVideoInfo(opts) {
|
|
152102
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152103
|
+
let path61;
|
|
152104
|
+
try {
|
|
152105
|
+
path61 = videoInfoQuery(account, opts.videoIds, opts.materialIds);
|
|
152106
|
+
} catch (err) {
|
|
152107
|
+
fail8("\u67E5\u8BE2\u89C6\u9891\u5931\u8D25", err);
|
|
152108
|
+
}
|
|
152109
|
+
try {
|
|
152110
|
+
await requestTikTok("GET", path61, void 0, opts, "tiktok-video-info", "tiktok-analysis video-info");
|
|
152111
|
+
} catch (err) {
|
|
152112
|
+
fail8("\u67E5\u8BE2\u89C6\u9891\u5931\u8D25", err);
|
|
152113
|
+
}
|
|
152114
|
+
}
|
|
152115
|
+
async function runTikTokIdentityList(opts) {
|
|
152116
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152117
|
+
try {
|
|
152118
|
+
await requestTikTokList(
|
|
152119
|
+
(pageNum, pageSize) => identityListPath(account, pageNum, pageSize, opts.identityType),
|
|
152120
|
+
opts,
|
|
152121
|
+
"list",
|
|
152122
|
+
"tiktok-identity-list",
|
|
152123
|
+
"tiktok-analysis identity-list",
|
|
152124
|
+
[
|
|
152125
|
+
{ key: "identityId", header: "\u8EAB\u4EFDID", fields: ["identity_id", "identityId"] },
|
|
152126
|
+
{ key: "identityType", header: "\u7C7B\u578B", fields: ["identity_type", "identityType"] },
|
|
152127
|
+
{ key: "displayName", header: "\u540D\u79F0", fields: ["display_name", "displayName"] }
|
|
152128
|
+
]
|
|
152129
|
+
);
|
|
152130
|
+
} catch (err) {
|
|
152131
|
+
fail8("\u67E5\u8BE2\u8EAB\u4EFD\u5931\u8D25", err);
|
|
152132
|
+
}
|
|
152133
|
+
}
|
|
152134
|
+
async function runTikTokIdentityCreate(opts) {
|
|
152135
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152136
|
+
let body;
|
|
152137
|
+
try {
|
|
152138
|
+
body = identityCreateBody(account, opts.displayName, opts.imageUri);
|
|
152139
|
+
} catch (err) {
|
|
152140
|
+
fail8("\u521B\u5EFA\u8EAB\u4EFD\u5931\u8D25", err);
|
|
152141
|
+
}
|
|
152142
|
+
try {
|
|
152143
|
+
await requestTikTok(
|
|
152144
|
+
"POST",
|
|
152145
|
+
identityCreatePath(),
|
|
152146
|
+
body,
|
|
152147
|
+
opts,
|
|
152148
|
+
"tiktok-identity-create",
|
|
152149
|
+
"tiktok-analysis identity-create"
|
|
152150
|
+
);
|
|
152151
|
+
} catch (err) {
|
|
152152
|
+
fail8("\u521B\u5EFA\u8EAB\u4EFD\u5931\u8D25", err);
|
|
152153
|
+
}
|
|
152154
|
+
}
|
|
152155
|
+
async function runTikTokAudienceList(opts) {
|
|
152156
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152157
|
+
try {
|
|
152158
|
+
await requestTikTokList(
|
|
152159
|
+
(pageNum, pageSize) => audienceListPath(account, pageNum, pageSize, opts.audienceIds),
|
|
152160
|
+
opts,
|
|
152161
|
+
"list",
|
|
152162
|
+
"tiktok-audience-list",
|
|
152163
|
+
"tiktok-analysis audience-list",
|
|
152164
|
+
[
|
|
152165
|
+
{ key: "audienceId", header: "\u53D7\u4F17ID", fields: ["audience_id", "custom_audience_id"] },
|
|
152166
|
+
{ key: "name", header: "\u540D\u79F0", fields: ["name", "custom_audience_name"] },
|
|
152167
|
+
{ key: "audienceType", header: "\u7C7B\u578B", fields: ["audience_type"] }
|
|
152168
|
+
]
|
|
152169
|
+
);
|
|
152170
|
+
} catch (err) {
|
|
152171
|
+
fail8("\u67E5\u8BE2\u53D7\u4F17\u5931\u8D25", err);
|
|
152172
|
+
}
|
|
152173
|
+
}
|
|
152174
|
+
async function runTikTokPixelList(opts) {
|
|
152175
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152176
|
+
try {
|
|
152177
|
+
await requestTikTokList(
|
|
152178
|
+
(pageNum, pageSize) => pixelListPath(account, pageNum, pageSize, {
|
|
152179
|
+
code: opts.code,
|
|
152180
|
+
pixelId: opts.pixelId,
|
|
152181
|
+
name: opts.name
|
|
152182
|
+
}),
|
|
152183
|
+
opts,
|
|
152184
|
+
"pixel",
|
|
152185
|
+
"tiktok-pixel-list",
|
|
152186
|
+
"tiktok-analysis pixel-list",
|
|
152187
|
+
[
|
|
152188
|
+
{ key: "pixelId", header: "\u50CF\u7D20ID", fields: ["pixel_id"] },
|
|
152189
|
+
{ key: "name", header: "\u540D\u79F0", fields: ["pixel_name", "name"] },
|
|
152190
|
+
{ key: "code", header: "\u4EE3\u7801", fields: ["pixel_code", "code"] }
|
|
152191
|
+
]
|
|
152192
|
+
);
|
|
152193
|
+
} catch (err) {
|
|
152194
|
+
fail8("\u67E5\u8BE2\u50CF\u7D20\u5931\u8D25", err);
|
|
152195
|
+
}
|
|
152196
|
+
}
|
|
152197
|
+
async function runTikTokPixelCreate(opts) {
|
|
152198
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152199
|
+
let body;
|
|
152200
|
+
try {
|
|
152201
|
+
body = pixelCreateBody(account, opts.name, opts.pixelCategory);
|
|
152202
|
+
} catch (err) {
|
|
152203
|
+
fail8("\u521B\u5EFA\u50CF\u7D20\u5931\u8D25", err);
|
|
152204
|
+
}
|
|
152205
|
+
try {
|
|
152206
|
+
await requestTikTok(
|
|
152207
|
+
"POST",
|
|
152208
|
+
pixelCreatePath(account),
|
|
152209
|
+
body,
|
|
152210
|
+
opts,
|
|
152211
|
+
"tiktok-pixel-create",
|
|
152212
|
+
"tiktok-analysis pixel-create"
|
|
152213
|
+
);
|
|
152214
|
+
} catch (err) {
|
|
152215
|
+
fail8("\u521B\u5EFA\u50CF\u7D20\u5931\u8D25", err);
|
|
152216
|
+
}
|
|
152217
|
+
}
|
|
152218
|
+
async function runTikTokPixelEventCreate(opts) {
|
|
152219
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152220
|
+
let body;
|
|
152221
|
+
try {
|
|
152222
|
+
body = pixelEventBody(account, opts.pixelId, parsePixelEvents(opts.events));
|
|
152223
|
+
} catch (err) {
|
|
152224
|
+
fail8("\u521B\u5EFA\u50CF\u7D20\u4E8B\u4EF6\u5931\u8D25", err);
|
|
152225
|
+
}
|
|
152226
|
+
try {
|
|
152227
|
+
await requestTikTok(
|
|
152228
|
+
"POST",
|
|
152229
|
+
pixelEventPath(),
|
|
152230
|
+
body,
|
|
152231
|
+
opts,
|
|
152232
|
+
"tiktok-pixel-event-create",
|
|
152233
|
+
"tiktok-analysis pixel-event-create"
|
|
152234
|
+
);
|
|
152235
|
+
} catch (err) {
|
|
152236
|
+
fail8("\u521B\u5EFA\u50CF\u7D20\u4E8B\u4EF6\u5931\u8D25", err);
|
|
152237
|
+
}
|
|
152238
|
+
}
|
|
152239
|
+
async function runTikTokPixelStats(opts) {
|
|
152240
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152241
|
+
let path61;
|
|
152242
|
+
try {
|
|
152243
|
+
path61 = pixelStatsPath(account, opts.pixelIds, opts.start, opts.end);
|
|
152244
|
+
} catch (err) {
|
|
152245
|
+
fail8("\u67E5\u8BE2\u50CF\u7D20\u7EDF\u8BA1\u5931\u8D25", err);
|
|
152246
|
+
}
|
|
152247
|
+
try {
|
|
152248
|
+
await requestTikTok("GET", path61, void 0, opts, "tiktok-pixel-stats", "tiktok-analysis pixel-stats");
|
|
152249
|
+
} catch (err) {
|
|
152250
|
+
fail8("\u67E5\u8BE2\u50CF\u7D20\u7EDF\u8BA1\u5931\u8D25", err);
|
|
152251
|
+
}
|
|
152252
|
+
}
|
|
152253
|
+
async function runTikTokCtaRecommendCreate(opts) {
|
|
152254
|
+
assertCtaCommit();
|
|
152255
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152256
|
+
let path61;
|
|
152257
|
+
try {
|
|
152258
|
+
path61 = ctaPortfolioPath(account, opts.contentType, opts.assetType);
|
|
152259
|
+
} catch (err) {
|
|
152260
|
+
fail8("\u521B\u5EFA CTA \u7EC4\u5408\u5931\u8D25", err);
|
|
152261
|
+
}
|
|
152262
|
+
try {
|
|
152263
|
+
await requestTikTok(
|
|
152264
|
+
"GET",
|
|
152265
|
+
path61,
|
|
152266
|
+
void 0,
|
|
152267
|
+
opts,
|
|
152268
|
+
"tiktok-cta-recommend-create",
|
|
152269
|
+
"tiktok-analysis cta-recommend-create"
|
|
152270
|
+
);
|
|
152271
|
+
} catch (err) {
|
|
152272
|
+
fail8("\u521B\u5EFA CTA \u7EC4\u5408\u5931\u8D25", err);
|
|
152273
|
+
}
|
|
152274
|
+
}
|
|
152275
|
+
var AUDIENCE_FILE_MAX_BYTES = 50 * 1024 * 1024;
|
|
152276
|
+
function audienceFileContentType(filename) {
|
|
152277
|
+
const lower = filename.toLowerCase();
|
|
152278
|
+
if (lower.endsWith(".csv")) return "text/csv";
|
|
152279
|
+
if (lower.endsWith(".txt")) return "text/plain";
|
|
152280
|
+
return "application/octet-stream";
|
|
152281
|
+
}
|
|
152282
|
+
async function runTikTokAudienceFileUpload(opts) {
|
|
152283
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152284
|
+
const calculate = (opts.calculateType ?? "").trim();
|
|
152285
|
+
const filePath = (opts.file ?? "").trim();
|
|
152286
|
+
if (!calculate || calculate.length > 40) {
|
|
152287
|
+
fail8("\u4E0A\u4F20\u53D7\u4F17\u6587\u4EF6\u5931\u8D25", new Error("calculate-type \u957F\u5EA6\u5FC5\u987B\u662F 1 \u5230 40"));
|
|
152288
|
+
}
|
|
152289
|
+
if (!filePath) {
|
|
152290
|
+
fail8("\u4E0A\u4F20\u53D7\u4F17\u6587\u4EF6\u5931\u8D25", new Error("\u53D7\u4F17\u6587\u4EF6\u8DEF\u5F84\u4E0D\u80FD\u4E3A\u7A7A"));
|
|
152291
|
+
}
|
|
152292
|
+
let data;
|
|
152293
|
+
try {
|
|
152294
|
+
data = readFileSync21(filePath);
|
|
152295
|
+
} catch (err) {
|
|
152296
|
+
fail8("\u4E0A\u4F20\u53D7\u4F17\u6587\u4EF6\u5931\u8D25", err);
|
|
152297
|
+
}
|
|
152298
|
+
if (data.length <= 0 || data.length > AUDIENCE_FILE_MAX_BYTES) {
|
|
152299
|
+
fail8("\u4E0A\u4F20\u53D7\u4F17\u6587\u4EF6\u5931\u8D25", new Error("\u53D7\u4F17\u6587\u4EF6\u5FC5\u987B\u5927\u4E8E 0\uFF0C\u4E14\u4E0D\u8D85\u8FC7 50MB"));
|
|
152300
|
+
}
|
|
152301
|
+
const filename = basename14(filePath);
|
|
152302
|
+
try {
|
|
152303
|
+
const config = loadConfig(opts.token);
|
|
152304
|
+
const url = `${requireTikTokApiUrl(config)}/tiktokgap/audiences/file-upload`;
|
|
152305
|
+
const payload = await apiFetchMultipart2(
|
|
152306
|
+
url,
|
|
152307
|
+
config,
|
|
152308
|
+
{
|
|
152309
|
+
fields: { advertiser_id: account, calculate_type: calculate },
|
|
152310
|
+
files: [{ field: "file", filename, contentType: audienceFileContentType(filename), data }]
|
|
152311
|
+
},
|
|
152312
|
+
!!opts.verbose
|
|
152313
|
+
);
|
|
152314
|
+
assertBusinessOk(payload, "tiktok-analysis audience-file-upload");
|
|
152315
|
+
const emitted = await emitCliJsonOrSnapshot(
|
|
152316
|
+
{ jsonOut: opts.jsonOut },
|
|
152317
|
+
{
|
|
152318
|
+
section: "tiktok-audience-file-upload",
|
|
152319
|
+
commandLabel: "tiktok-analysis audience-file-upload",
|
|
152320
|
+
payload,
|
|
152321
|
+
idSuffix: account
|
|
152322
|
+
}
|
|
152323
|
+
);
|
|
152324
|
+
if (emitted) return;
|
|
152325
|
+
console.log("\n\u2705 tiktok-analysis audience-file-upload\n");
|
|
152326
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
152327
|
+
console.log();
|
|
152328
|
+
} catch (err) {
|
|
152329
|
+
fail8("\u4E0A\u4F20\u53D7\u4F17\u6587\u4EF6\u5931\u8D25", err);
|
|
152330
|
+
}
|
|
152331
|
+
}
|
|
152332
|
+
async function runTikTokSmartText(opts) {
|
|
152333
|
+
const account = assertTikTokAccountId(opts.account);
|
|
152334
|
+
let body;
|
|
152335
|
+
try {
|
|
152336
|
+
body = smartTextBody(account, opts);
|
|
152337
|
+
} catch (err) {
|
|
152338
|
+
fail8("\u751F\u6210\u667A\u80FD\u6587\u6848\u5931\u8D25", err);
|
|
152339
|
+
}
|
|
152340
|
+
try {
|
|
152341
|
+
await requestTikTok("POST", smartTextPath(), body, opts, "tiktok-smart-text", "tiktok-analysis smart-text");
|
|
152342
|
+
} catch (err) {
|
|
152343
|
+
fail8("\u751F\u6210\u667A\u80FD\u6587\u6848\u5931\u8D25", err);
|
|
152344
|
+
}
|
|
152345
|
+
}
|
|
152346
|
+
|
|
152347
|
+
// src/commands/tiktok-analysis/register-media.ts
|
|
151320
152348
|
var ACCOUNT_OPTION3 = [
|
|
151321
152349
|
"-a, --account <id>",
|
|
151322
152350
|
"TikTok \u5E7F\u544A\u4E3B mediaCustomerId\uFF08\u6570\u5B57\uFF0C\u4E0E list-accounts -m TikTok \u4E00\u81F4\uFF09"
|
|
151323
152351
|
];
|
|
151324
152352
|
var JSON_OUT_OPTION_DESC3 = "\u843D\u76D8\uFF08\u76EE\u5F55\u6216 *.json \u6587\u4EF6\u8DEF\u5F84\uFF09\u5E76\u66F4\u65B0 cli-manifest[-<\u67E5\u8BE2id>].json\uFF1Bstdout \u4E00\u884C\u6458\u8981 JSON";
|
|
152353
|
+
function registerTikTokMediaCommands(root) {
|
|
152354
|
+
root.command("image-upload").description("\u7528\u516C\u7F51 https \u5730\u5740\u4E0A\u4F20\u5E7F\u544A\u56FE\u7247\uFF08UPLOAD_BY_URL\uFF09\u3002\u8FD4\u56DE\u7684 image_id \u624D\u80FD\u5F53\u8EAB\u4EFD\u5934\u50CF\u6216\u7D20\u6750\u3002\u4E0D\u6536\u672C\u5730\u6587\u4EF6\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--image-url <url>", "https \u56FE\u7247\u5730\u5740").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152355
|
+
await runTikTokImageUpload(opts);
|
|
152356
|
+
});
|
|
152357
|
+
root.command("video-upload").description("\u7528\u516C\u7F51 https \u5730\u5740\u76F4\u63A5\u4E0A\u4F20\u5E7F\u544A\u89C6\u9891\uFF08UPLOAD_BY_URL\uFF09\uFF0C\u5E76\u5173\u95ED\u81EA\u52A8\u4FEE\u590D\u3002\u4E0D\u6536\u672C\u5730\u6587\u4EF6\uFF0C\u4E0D\u8981\u81EA\u5DF1\u62C6\u7247\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--video-url <url>", "https \u89C6\u9891\u5730\u5740").option("--name <name>", "\u6587\u4EF6\u540D").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152358
|
+
await runTikTokVideoUpload(opts);
|
|
152359
|
+
});
|
|
152360
|
+
root.command("video-upload-url").description("\u7528\u516C\u7F51 https \u5730\u5740\u7ECF\u7F51\u5173\u4E34\u65F6\u6587\u4EF6\u4E2D\u8F6C\u540E\u7ED1\u5B9A\u89C6\u9891\uFF0C\u5355\u6587\u4EF6 100MB\u3002\u4E0D\u6536\u672C\u5730\u6587\u4EF6\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--video-url <url>", "https \u89C6\u9891\u5730\u5740").option("--name <name>", "\u89C6\u9891\u540D\u79F0").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152361
|
+
await runTikTokVideoUploadByUrl(opts);
|
|
152362
|
+
});
|
|
152363
|
+
root.command("video-info").description("\u6309\u89C6\u9891 ID \u6216\u7D20\u6750 ID \u67E5\u89C6\u9891\u4FE1\u606F\u3002\u4E0D\u662F\u7D20\u6750\u5E93\u5217\u8868\uFF0C\u4E24\u4E2A ID \u81F3\u5C11\u7ED9\u4E00\u4E2A").requiredOption(...ACCOUNT_OPTION3).option("--video-ids <ids>", "\u9017\u53F7\u5206\u9694\u7684 video_id").option("--material-ids <ids>", "\u9017\u53F7\u5206\u9694\u7684 material_id").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152364
|
+
await runTikTokVideoInfo({ ...opts, materialIds: opts.materialIds });
|
|
152365
|
+
});
|
|
152366
|
+
root.command("identity-list").description("\u5E7F\u544A\u8EAB\u4EFD\u5217\u8868\uFF08/identity/get/\uFF09\u3002\u53EF\u9009\u6309 identity-type \u8FC7\u6EE4").requiredOption(...ACCOUNT_OPTION3).option("--identity-type <type>", "CUSTOMIZED_USER / AUTH_CODE / TT_USER / BC_AUTH_TT").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152367
|
+
await runTikTokIdentityList(opts);
|
|
152368
|
+
});
|
|
152369
|
+
root.command("identity-create").description("\u521B\u5EFA CUSTOMIZED_USER \u8EAB\u4EFD\u3002--image-uri \u5FC5\u987B\u662F\u672C\u8D26\u6237 image-upload \u8FD4\u56DE\u7684 image_id\uFF0C\u7F51\u5173\u4E0D\u518D\u4EE3\u586B\u5934\u50CF\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--display-name <name>", "\u8EAB\u4EFD\u663E\u793A\u540D").requiredOption("--image-uri <id>", "image-upload \u8FD4\u56DE\u7684 image_id").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152370
|
+
await runTikTokIdentityCreate(opts);
|
|
152371
|
+
});
|
|
152372
|
+
root.command("audience-list").description("\u81EA\u5B9A\u4E49\u53D7\u4F17\u5217\u8868\u3002\u4E0D\u662F Lookalike \u521B\u5EFA\u6216\u91CD\u53E0\u5206\u6790").requiredOption(...ACCOUNT_OPTION3).option("--audience-ids <ids>", "\u9017\u53F7\u5206\u9694\u7684\u53D7\u4F17 ID").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152373
|
+
await runTikTokAudienceList(opts);
|
|
152374
|
+
});
|
|
152375
|
+
root.command("pixel-list").description("\u50CF\u7D20\u5217\u8868\u3002\u6BCF\u9875\u6700\u591A 20 \u6761").requiredOption(...ACCOUNT_OPTION3).option("--code <code>", "\u6309 pixel code \u8FC7\u6EE4").option("--pixel-id <id>", "\u6309\u50CF\u7D20 ID \u8FC7\u6EE4").option("--name <name>", "\u6309\u540D\u79F0\u8FC7\u6EE4").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 20\uFF0C\u4E0A\u9650 20", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152376
|
+
await runTikTokPixelList(opts);
|
|
152377
|
+
});
|
|
152378
|
+
root.command("pixel-create").description("\u521B\u5EFA\u50CF\u7D20\u3002\u540D\u79F0\u4E0D\u8D85\u8FC7 40 \u4E2A\u5B57\u7B26\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--name <name>", "\u50CF\u7D20\u540D\u79F0").requiredOption("--pixel-category <category>", "\u5B98\u65B9 pixel_category").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152379
|
+
await runTikTokPixelCreate(opts);
|
|
152380
|
+
});
|
|
152381
|
+
root.command("pixel-event-create").description("\u7ED9\u50CF\u7D20\u52A0\u4E8B\u4EF6\u3002--events \u662F\u5B98\u65B9 pixel_events \u7684 JSON \u6570\u7EC4\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--pixel-id <id>", "\u50CF\u7D20 ID").requiredOption("--events <json>", "\u975E\u7A7A JSON \u6570\u7EC4").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152382
|
+
await runTikTokPixelEventCreate(opts);
|
|
152383
|
+
});
|
|
152384
|
+
root.command("pixel-stats").description("\u50CF\u7D20\u4E8B\u4EF6\u7EDF\u8BA1\u3002\u533A\u95F4\u8DE8\u5EA6\u4E0D\u8D85\u8FC7 30 \u5929\uFF0C\u4E00\u6B21 1 \u5230 10 \u4E2A\u50CF\u7D20").requiredOption(...ACCOUNT_OPTION3).requiredOption("--pixel-ids <ids>", "\u9017\u53F7\u5206\u9694\uFF0C1 \u5230 10 \u4E2A").requiredOption("--start <date>", "YYYY-MM-DD").requiredOption("--end <date>", "YYYY-MM-DD").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152385
|
+
await runTikTokPixelStats(opts);
|
|
152386
|
+
});
|
|
152387
|
+
root.command("cta-recommend-create").description("\u6309\u63A8\u8350 CTA \u7ACB\u523B\u521B\u5EFA\u7EC4\u5408\uFF08\u4E0D\u662F\u5217\u8868\uFF09\u3002\u7F51\u5173\u5148\u62C9\u63A8\u8350\u518D\u521B\u5EFA\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--content-type <type>", "\u5B98\u65B9 content_type\uFF0C\u5982 LANDING_PAGE").requiredOption("--asset-type <type>", "\u5B98\u65B9 asset_type").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152388
|
+
await runTikTokCtaRecommendCreate(opts);
|
|
152389
|
+
});
|
|
152390
|
+
root.command("smart-text").description("\u751F\u6210\u667A\u80FD\u6587\u6848\u3002\u5B98\u65B9\u8981\u6C42\u5E7F\u544A\u7EC4 ID\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--adgroup-id <id>", "\u5E7F\u544A\u7EC4 ID").option("--param-type <type>", "\u5B98\u65B9 param_type").option("--language <lang>", "\u6587\u6848\u8BED\u8A00").option("--industry-id <id>", "\u884C\u4E1A ID").option("--keywords <list>", "\u9017\u53F7\u5206\u9694\u5173\u952E\u8BCD").option("--limit <n>", "\u6761\u6570\uFF0C\u5927\u4E8E 0 \u7684\u6574\u6570").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152391
|
+
await runTikTokSmartText(opts);
|
|
152392
|
+
});
|
|
152393
|
+
root.command("audience-file-upload").description("\u628A\u672C\u5730\u53D7\u4F17\u6587\u4EF6\u4E0A\u4F20\u5230 TikTok\u3002\u8FD4\u56DE\u7684\u8DEF\u5F84\u624D\u80FD\u7ED9 tiktok.audience-file \u7684 file_paths\u3002\u5355\u6587\u4EF6 50MB\u3002\u5199\u64CD\u4F5C\u987B --commit").requiredOption(...ACCOUNT_OPTION3).requiredOption("--file <path>", "\u672C\u5730 csv \u6216 txt").requiredOption("--calculate-type <type>", "\u5B98\u65B9 calculate_type\uFF0C\u5982 EMAIL_SHA256").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC3).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
152394
|
+
await runTikTokAudienceFileUpload(opts);
|
|
152395
|
+
});
|
|
152396
|
+
}
|
|
152397
|
+
|
|
152398
|
+
// src/commands/tiktok-analysis/register-cli.ts
|
|
152399
|
+
var ACCOUNT_OPTION4 = [
|
|
152400
|
+
"-a, --account <id>",
|
|
152401
|
+
"TikTok \u5E7F\u544A\u4E3B mediaCustomerId\uFF08\u6570\u5B57\uFF0C\u4E0E list-accounts -m TikTok \u4E00\u81F4\uFF09"
|
|
152402
|
+
];
|
|
152403
|
+
var JSON_OUT_OPTION_DESC4 = "\u843D\u76D8\uFF08\u76EE\u5F55\u6216 *.json \u6587\u4EF6\u8DEF\u5F84\uFF09\u5E76\u66F4\u65B0 cli-manifest[-<\u67E5\u8BE2id>].json\uFF1Bstdout \u4E00\u884C\u6458\u8981 JSON";
|
|
151325
152404
|
function registerBatchCommand3(sectionHelp, aliasHelp) {
|
|
151326
152405
|
return new Command4("run").description(
|
|
151327
152406
|
"\u6279\u91CF\u62C9\u53D6 TSO reporting/media-account/TikTok Section \u6570\u636E\uFF08\u7701\u7565\u5B50\u547D\u4EE4\u540D\u65F6\u9ED8\u8BA4\u6267\u884C\u672C\u547D\u4EE4\uFF09"
|
|
@@ -151343,7 +152422,7 @@ function registerTikTokAnalysisCommands(program2) {
|
|
|
151343
152422
|
const sectionHelp = TIKTOK_SECTION_NAMES.join(", ");
|
|
151344
152423
|
const aliasHelp = Object.keys(TIKTOK_SECTION_ALIASES).join(", ");
|
|
151345
152424
|
const root = program2.command("tiktok-analysis").description(
|
|
151346
|
-
"TikTok \u8D26\u6237\u5206\u6790\uFF1A\u6279\u91CF\u62C9\u53D6 TSO \u770B\u677F Section\uFF08\u9ED8\u8BA4\uFF09\u3001render \u5468\u671F HTML\uFF0C\
|
|
152425
|
+
"TikTok \u8D26\u6237\u5206\u6790\uFF1A\u6279\u91CF\u62C9\u53D6 TSO \u770B\u677F Section\uFF08\u9ED8\u8BA4\uFF09\u3001render \u5468\u671F HTML\uFF0C\u67E5\u8BE2\u8D26\u6237\u72B6\u6001/\u7CFB\u5217/\u7EC4/\u5E7F\u544A/\u5B98\u65B9\u62A5\u8868\uFF0C\u4EE5\u53CA\u516C\u7F51\u7D20\u6750\u3001\u8EAB\u4EFD\u3001\u50CF\u7D20\u3001\u53D7\u4F17\u5217\u8868\u3001CTA \u7EC4\u5408\u3001\u667A\u80FD\u6587\u6848"
|
|
151347
152426
|
);
|
|
151348
152427
|
root.addCommand(registerBatchCommand3(sectionHelp, aliasHelp), { isDefault: true });
|
|
151349
152428
|
root.command("render").description(
|
|
@@ -151420,25 +152499,25 @@ function registerTikTokAnalysisCommands(program2) {
|
|
|
151420
152499
|
);
|
|
151421
152500
|
root.command("account-status").description(
|
|
151422
152501
|
"\u8D26\u6237\u72B6\u6001/\u4F59\u989D/\u65F6\u533A\uFF08GET \u2026/GetAdvertiserInfo/Tiktok\uFF1BSTATUS_ENABLE \u4E3A\u6B63\u5E38\uFF1B\u987B\u62E5\u6709\u8BE5\u5E7F\u544A\u4E3B\uFF09"
|
|
151423
|
-
).requiredOption(...
|
|
152502
|
+
).requiredOption(...ACCOUNT_OPTION4).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
151424
152503
|
async (opts) => {
|
|
151425
152504
|
await runTikTokAccountStatus(opts);
|
|
151426
152505
|
}
|
|
151427
152506
|
);
|
|
151428
152507
|
root.command("campaign-entities").description(
|
|
151429
152508
|
"\u7CFB\u5217\u539F\u59CB\u5B9E\u4F53\uFF08GET \u2026/campaign/Tiktok\uFF1Abudget/budget_mode/CBO/operation_status\uFF1B\u4E0E `run --sections campaigns` \u7684\u770B\u677F\u82B1\u8D39\u4E0D\u540C\uFF09"
|
|
151430
|
-
).requiredOption(...
|
|
152509
|
+
).requiredOption(...ACCOUNT_OPTION4).option("--campaign-ids <ids>", "\u9017\u53F7\u5206\u9694\u7CFB\u5217 ID\uFF0C\u5199\u5165 filtering.CampaignIds").option(
|
|
151431
152510
|
"--page-size <n>",
|
|
151432
152511
|
"\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000\uFF08\u5FC5\u987B\u663E\u5F0F\u4F20\u7ED9\u7F51\u5173\uFF09",
|
|
151433
152512
|
(v) => parseInt(v, 10)
|
|
151434
|
-
).option("-t, --token <token>", "Auth Token").option("--json-out <path>",
|
|
152513
|
+
).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
151435
152514
|
async (opts) => {
|
|
151436
152515
|
await runTikTokCampaignEntities(opts);
|
|
151437
152516
|
}
|
|
151438
152517
|
);
|
|
151439
152518
|
root.command("adgroup-entities").description(
|
|
151440
152519
|
"\u5E7F\u544A\u7EC4\u539F\u59CB\u5B9E\u4F53\uFF08GET \u2026/adgroup/Tiktok\uFF1Abid_type \u4E0E\u5BF9\u5E94\u51FA\u4EF7\u3001\u7EC4\u9884\u7B97\uFF1BCBO \u65F6\u7EC4\u9884\u7B97\u4E3A 0\uFF09"
|
|
151441
|
-
).requiredOption(...
|
|
152520
|
+
).requiredOption(...ACCOUNT_OPTION4).option("--campaign-ids <ids>", "\u9017\u53F7\u5206\u9694\u7CFB\u5217 ID").option("--adgroup-ids <ids>", "\u9017\u53F7\u5206\u9694\u5E7F\u544A\u7EC4 ID").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
151442
152521
|
async (opts) => {
|
|
151443
152522
|
await runTikTokAdGroupEntities({
|
|
151444
152523
|
...opts,
|
|
@@ -151448,10 +152527,10 @@ function registerTikTokAnalysisCommands(program2) {
|
|
|
151448
152527
|
);
|
|
151449
152528
|
root.command("ad-entities").description(
|
|
151450
152529
|
`\u5E7F\u544A\u539F\u59CB\u5B9E\u4F53\uFF08GET \u2026/ad/Tiktok\uFF1A\u843D\u5730\u9875/\u62D2\u5BA1\uFF1B\u62D2\u5BA1\u4F20 --secondary-status ${TIKTOK_AD_AUDIT_DENY}\uFF09`
|
|
151451
|
-
).requiredOption(...
|
|
152530
|
+
).requiredOption(...ACCOUNT_OPTION4).option("--campaign-ids <ids>", "\u9017\u53F7\u5206\u9694\u7CFB\u5217 ID").option("--adgroup-ids <ids>", "\u9017\u53F7\u5206\u9694\u5E7F\u544A\u7EC4 ID").option("--ad-ids <ids>", "\u9017\u53F7\u5206\u9694\u5E7F\u544A ID").option(
|
|
151452
152531
|
"--secondary-status <status>",
|
|
151453
152532
|
`\u5B98\u65B9 secondary_status \u5355\u503C\uFF0C\u5982 ${TIKTOK_AD_AUDIT_DENY}\uFF1B\u52FF\u4F20\u9EC4\u6761 REVIEW_PARTIALLY_APPROVED`
|
|
151454
|
-
).option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>",
|
|
152533
|
+
).option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 100\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
151455
152534
|
async (opts) => {
|
|
151456
152535
|
await runTikTokAdEntities({
|
|
151457
152536
|
...opts,
|
|
@@ -151461,34 +152540,35 @@ function registerTikTokAnalysisCommands(program2) {
|
|
|
151461
152540
|
);
|
|
151462
152541
|
root.command("official-report").description(
|
|
151463
152542
|
"TikTokAPI \u5B98\u65B9\u62A5\u8868\uFF08GET \u2026/query/report/Tiktok/search\uFF1B\u53EF\u542B\u4ECA\u5929/\u5C0F\u65F6\uFF1B\u4E0E `run` \u7684 TSO \u770B\u677F\u5468\u671F\u62A5\u8868\u4E0D\u540C\u3002ServiceType/DataLevel/Dimensions/Metrics/\u65E5\u671F/PageSize \u5FC5\u586B\uFF09"
|
|
151464
|
-
).requiredOption(...
|
|
152543
|
+
).requiredOption(...ACCOUNT_OPTION4).requiredOption("--start <date>", "\u5F00\u59CB\u65E5\u671F YYYY-MM-DD\uFF08\u6309\u5E7F\u544A\u4E3B timezone \u81EA\u7136\u65E5\uFF09").requiredOption("--end <date>", "\u7ED3\u675F\u65E5\u671F YYYY-MM-DD").requiredOption("--data-level <level>", "AUCTION_CAMPAIGN / AUCTION_ADGROUP / AUCTION_AD").requiredOption("--dimensions <list>", "\u9017\u53F7\u5206\u9694\uFF0C\u5982 campaign_id \u6216 adgroup_id,stat_time_hour").requiredOption(
|
|
151465
152544
|
"--metrics <list>",
|
|
151466
152545
|
"\u9017\u53F7\u5206\u9694\uFF0C\u82B1\u8D39\u987B\u7528 spend\uFF08\u4E0D\u8981 stat_cost\uFF09\u3002complete_payment \u662F\u7F51\u9875\u5B8C\u4ED8\u6B21\u6570\u3002\u542B\u5B8C\u4ED8/ROAS \u65F6\u81EA\u52A8\u9644\u5E26 total_purchase_value,complete_payment_roas,total_active_pay_roas"
|
|
151467
|
-
).option("--service-type <type>", "AUCTION\uFF08\u9ED8\u8BA4\uFF09\u6216 RESERVATION", "AUCTION").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 200\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>",
|
|
152546
|
+
).option("--service-type <type>", "AUCTION\uFF08\u9ED8\u8BA4\uFF09\u6216 RESERVATION", "AUCTION").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 200\uFF0C\u4E0A\u9650 1000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
151468
152547
|
async (opts) => {
|
|
151469
152548
|
await runTikTokOfficialReport(opts);
|
|
151470
152549
|
}
|
|
151471
152550
|
);
|
|
151472
|
-
root.command("campaign-status").description("\u542F\u505C\u63A8\u5E7F\u7CFB\u5217\uFF08PUT \u2026/campaign/updatestatus/Tiktok\uFF1BENABLE \u6216 DISABLE\uFF09").requiredOption(...
|
|
152551
|
+
root.command("campaign-status").description("\u542F\u505C\u63A8\u5E7F\u7CFB\u5217\uFF08PUT \u2026/campaign/updatestatus/Tiktok\uFF1BENABLE \u6216 DISABLE\uFF09").requiredOption(...ACCOUNT_OPTION4).requiredOption("--campaign-id <id>", "\u63A8\u5E7F\u7CFB\u5217 ID").requiredOption("--status <status>", "ENABLE \u6216 DISABLE").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
151473
152552
|
await runTikTokCampaignStatus(opts);
|
|
151474
152553
|
});
|
|
151475
152554
|
root.command("campaign-budget").description(
|
|
151476
152555
|
"\u6539\u63A8\u5E7F\u7CFB\u5217\u9884\u7B97\uFF08PUT \u2026/campaign/update/Tiktok\uFF1B\u65E5\u9884\u7B97\u4E0E\u603B\u9884\u7B97\u4E0D\u80FD\u4E92\u5207\uFF0C\u4E0D\u652F\u6301\u4E0D\u9650\u9884\u7B97\uFF09"
|
|
151477
|
-
).requiredOption(...
|
|
152556
|
+
).requiredOption(...ACCOUNT_OPTION4).requiredOption("--campaign-id <id>", "\u63A8\u5E7F\u7CFB\u5217 ID").requiredOption("--budget <amount>", "\u9884\u7B97\uFF0C\u5E7F\u544A\u4E3B\u5E01\u79CD\uFF0C\u5FC5\u987B\u5927\u4E8E 0").requiredOption(
|
|
151478
152557
|
"--budget-mode <mode>",
|
|
151479
152558
|
"BUDGET_MODE_DAY / BUDGET_MODE_TOTAL / BUDGET_MODE_DYNAMIC_DAILY_BUDGET"
|
|
151480
|
-
).option("-t, --token <token>", "Auth Token").option("--json-out <path>",
|
|
152559
|
+
).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
151481
152560
|
await runTikTokCampaignBudget(opts);
|
|
151482
152561
|
});
|
|
151483
|
-
root.command("adgroup-status").description("\u542F\u505C\u5E7F\u544A\u7EC4\uFF08PUT \u2026/adgroup/UpdateStatus/Tiktok/{entityId}\uFF1BentityId \u6309\u5E7F\u544A\u4E3B\u81EA\u52A8\u67E5\uFF09").requiredOption(...
|
|
152562
|
+
root.command("adgroup-status").description("\u542F\u505C\u5E7F\u544A\u7EC4\uFF08PUT \u2026/adgroup/UpdateStatus/Tiktok/{entityId}\uFF1BentityId \u6309\u5E7F\u544A\u4E3B\u81EA\u52A8\u67E5\uFF09").requiredOption(...ACCOUNT_OPTION4).requiredOption("--adgroup-id <id>", "\u5E7F\u544A\u7EC4 ID").requiredOption("--status <status>", "ENABLE \u6216 DISABLE").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
151484
152563
|
await runTikTokAdGroupStatus({ ...opts, adGroupId: opts.adgroupId });
|
|
151485
152564
|
});
|
|
151486
|
-
root.command("adgroup-budget").description("\u6539\u5E7F\u544A\u7EC4\u9884\u7B97\uFF08PUT \u2026/adgroup/UpdateBudget\uFF1BCBO \u6216\u65E0\u9650\u9884\u7B97\u65F6\u7EC4\u9884\u7B97\u53EF\u80FD\u6539\u4E0D\u52A8\uFF09").requiredOption(...
|
|
152565
|
+
root.command("adgroup-budget").description("\u6539\u5E7F\u544A\u7EC4\u9884\u7B97\uFF08PUT \u2026/adgroup/UpdateBudget\uFF1BCBO \u6216\u65E0\u9650\u9884\u7B97\u65F6\u7EC4\u9884\u7B97\u53EF\u80FD\u6539\u4E0D\u52A8\uFF09").requiredOption(...ACCOUNT_OPTION4).requiredOption("--adgroup-id <id>", "\u5E7F\u544A\u7EC4 ID").requiredOption("--budget <amount>", "\u9884\u7B97\uFF0C\u5E7F\u544A\u4E3B\u5E01\u79CD\uFF0C\u5FC5\u987B\u5927\u4E8E 0").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
151487
152566
|
await runTikTokAdGroupBudget({ ...opts, adGroupId: opts.adgroupId });
|
|
151488
152567
|
});
|
|
151489
|
-
root.command("ad-status").description("\u542F\u505C\u5E7F\u544A\uFF08PUT \u2026/ad/updatestatus/Tiktok\uFF1BENABLE \u6216 DISABLE\uFF09").requiredOption(...
|
|
152568
|
+
root.command("ad-status").description("\u542F\u505C\u5E7F\u544A\uFF08PUT \u2026/ad/updatestatus/Tiktok\uFF1BENABLE \u6216 DISABLE\uFF09").requiredOption(...ACCOUNT_OPTION4).requiredOption("--ad-id <id>", "\u5E7F\u544A ID").requiredOption("--status <status>", "ENABLE \u6216 DISABLE").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC4).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
151490
152569
|
await runTikTokAdStatus(opts);
|
|
151491
152570
|
});
|
|
152571
|
+
registerTikTokMediaCommands(root);
|
|
151492
152572
|
}
|
|
151493
152573
|
|
|
151494
152574
|
// src/commands/yandex-analysis/register-cli.ts
|
|
@@ -152333,12 +153413,12 @@ init_lang();
|
|
|
152333
153413
|
init_html();
|
|
152334
153414
|
var TEMPLATE_BASENAME6 = "yandex-period-report.html";
|
|
152335
153415
|
var INJECT_MARKER6 = "window.__YANDEX_PERIOD_REPORT__ = window.__YANDEX_PERIOD_REPORT__ || null;";
|
|
152336
|
-
function resolveSkillTemplatePath9(
|
|
153416
|
+
function resolveSkillTemplatePath9(basename15) {
|
|
152337
153417
|
const dir = path59.dirname(fileURLToPath15(import.meta.url));
|
|
152338
153418
|
const candidates = [
|
|
152339
|
-
path59.join(dir, "skill", "report-templates",
|
|
152340
|
-
path59.join(dir, "skill", "siluzan-ads", "report-templates",
|
|
152341
|
-
path59.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates",
|
|
153419
|
+
path59.join(dir, "skill", "report-templates", basename15),
|
|
153420
|
+
path59.join(dir, "skill", "siluzan-ads", "report-templates", basename15),
|
|
153421
|
+
path59.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename15)
|
|
152342
153422
|
];
|
|
152343
153423
|
for (const p of candidates) {
|
|
152344
153424
|
if (fs48.existsSync(p)) return p;
|
|
@@ -152588,7 +153668,7 @@ function asRecord43(raw) {
|
|
|
152588
153668
|
}
|
|
152589
153669
|
|
|
152590
153670
|
// src/commands/yandex-analysis/entities.ts
|
|
152591
|
-
function
|
|
153671
|
+
function fail9(label2, err) {
|
|
152592
153672
|
const msg = err instanceof Error ? err.message : String(err);
|
|
152593
153673
|
console.error(`
|
|
152594
153674
|
\u274C ${label2}\uFF1A${msg}
|
|
@@ -152660,7 +153740,7 @@ async function runYandexAccountStatus(opts) {
|
|
|
152660
153740
|
try {
|
|
152661
153741
|
result = await fetchPath(opts, "overview", {});
|
|
152662
153742
|
} catch (err) {
|
|
152663
|
-
|
|
153743
|
+
fail9("\u67E5\u8BE2 Yandex \u8D26\u6237\u603B\u89C8\u5931\u8D25", err);
|
|
152664
153744
|
}
|
|
152665
153745
|
const row = asRecord43(result.raw);
|
|
152666
153746
|
await emitOrTable(opts, {
|
|
@@ -152702,7 +153782,7 @@ async function runYandexCampaignEntities(opts) {
|
|
|
152702
153782
|
network: flags.network
|
|
152703
153783
|
});
|
|
152704
153784
|
} catch (err) {
|
|
152705
|
-
|
|
153785
|
+
fail9("\u67E5\u8BE2 Yandex \u7CFB\u5217\u5931\u8D25", err);
|
|
152706
153786
|
}
|
|
152707
153787
|
const items3 = unwrapYandexItems(result.raw);
|
|
152708
153788
|
await emitOrTable(opts, {
|
|
@@ -152748,7 +153828,7 @@ async function runYandexAdGroupEntities(opts) {
|
|
|
152748
153828
|
campaignId: flags.campaignId
|
|
152749
153829
|
});
|
|
152750
153830
|
} catch (err) {
|
|
152751
|
-
|
|
153831
|
+
fail9("\u67E5\u8BE2 Yandex \u5E7F\u544A\u7EC4\u5931\u8D25", err);
|
|
152752
153832
|
}
|
|
152753
153833
|
const items3 = unwrapYandexItems(result.raw);
|
|
152754
153834
|
await emitOrTable(opts, {
|
|
@@ -152798,7 +153878,7 @@ async function runYandexAdEntities(opts) {
|
|
|
152798
153878
|
adGroupId: flags.adGroupId
|
|
152799
153879
|
});
|
|
152800
153880
|
} catch (err) {
|
|
152801
|
-
|
|
153881
|
+
fail9("\u67E5\u8BE2 Yandex \u5E7F\u544A\u5931\u8D25", err);
|
|
152802
153882
|
}
|
|
152803
153883
|
const items3 = unwrapYandexItems(result.raw);
|
|
152804
153884
|
const filtered = flags.status != null;
|
|
@@ -152850,7 +153930,7 @@ async function runYandexInsights(opts) {
|
|
|
152850
153930
|
adGroupId: flags.adGroupId
|
|
152851
153931
|
});
|
|
152852
153932
|
} catch (err) {
|
|
152853
|
-
|
|
153933
|
+
fail9("\u67E5\u8BE2 Yandex insights \u5931\u8D25", err);
|
|
152854
153934
|
}
|
|
152855
153935
|
const items3 = unwrapYandexItems(result.raw);
|
|
152856
153936
|
await emitOrTable(opts, {
|
|
@@ -152987,11 +154067,11 @@ async function runYandexKeywordBid(opts) {
|
|
|
152987
154067
|
}
|
|
152988
154068
|
|
|
152989
154069
|
// src/commands/yandex-analysis/register-cli.ts
|
|
152990
|
-
var
|
|
154070
|
+
var ACCOUNT_OPTION5 = [
|
|
152991
154071
|
"-a, --account <id>",
|
|
152992
154072
|
"Yandex Client-Login / mediaCustomerId\uFF08\u5982 porg-xxx\uFF0C\u4E0E list-accounts -m Yandex \u4E00\u81F4\uFF09"
|
|
152993
154073
|
];
|
|
152994
|
-
var
|
|
154074
|
+
var JSON_OUT_OPTION_DESC5 = "\u843D\u76D8\uFF08\u76EE\u5F55\u6216 *.json \u6587\u4EF6\u8DEF\u5F84\uFF09\u5E76\u66F4\u65B0 cli-manifest[-<\u67E5\u8BE2id>].json\uFF1Bstdout \u4E00\u884C\u6458\u8981 JSON";
|
|
152995
154075
|
var START_OPTION = [
|
|
152996
154076
|
"--start <date>",
|
|
152997
154077
|
"\u5F00\u59CB\u65E5\u671F YYYY-MM-DD\uFF08\u4E0E --end \u540C\u4F20\u6216\u540C\u7701\u7565\uFF1B\u7701\u7565=\u5F53\u5929\uFF09"
|
|
@@ -153040,55 +154120,55 @@ function registerYandexAnalysisCommands(program2) {
|
|
|
153040
154120
|
});
|
|
153041
154121
|
root.command("account-status").description(
|
|
153042
154122
|
"\u8D26\u6237\u5F52\u6863/\u4F59\u989D/\u533A\u95F4 KPI\uFF08GET /overview\uFF1Barchived=true \u4E3A\u5DF2\u5F52\u6863\uFF1B\u5B98\u65B9\u65E0\u5C01\u6237\u539F\u56E0\uFF1B\u7701\u7565\u65E5\u671F=\u5F53\u5929\uFF09"
|
|
153043
|
-
).requiredOption(...
|
|
154123
|
+
).requiredOption(...ACCOUNT_OPTION5).option(...START_OPTION).option(...END_OPTION).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
153044
154124
|
async (opts) => {
|
|
153045
154125
|
await runYandexAccountStatus(opts);
|
|
153046
154126
|
}
|
|
153047
154127
|
);
|
|
153048
154128
|
root.command("campaign-entities").description(
|
|
153049
154129
|
"\u7CFB\u5217\u7EE9\u6548+\u9884\u7B97/\u7B56\u7565\uFF08GET /campaigns\uFF1Aspend/weeklyBudget/budget/strategy/targetCpa\uFF1B\u5168\u6E20\u9053\u82B1\u8D39\u987B --network ALL\uFF1B\u53EF --time-increment 1 \u6309\u65E5\uFF09"
|
|
153050
|
-
).requiredOption(...
|
|
154130
|
+
).requiredOption(...ACCOUNT_OPTION5).option(...START_OPTION).option(...END_OPTION).option("--time-increment <n>", "\u4F20 1 \u6309\u65E5\u5207\u5206\uFF1B\u4E0D\u4F20=\u533A\u95F4\u6C47\u603B\u3002Direct \u65E0\u5C0F\u65F6\u7EF4\u5EA6").option("--network <value>", "SEARCH\uFF08\u9ED8\u8BA4\uFF09\u6216 ALL\uFF08\u5168\u7F51\u4E00\u884C\u5408\u8BA1\uFF0C\u884C\u5185 network \u4E3A null\uFF09").option("--limit <n>", "\u6761\u6570\u4E0A\u9650\uFF08\u9ED8\u8BA4\u7F51\u5173 100\uFF0C\u6700\u5927 10000\uFF09", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
153051
154131
|
async (opts) => {
|
|
153052
154132
|
await runYandexCampaignEntities(opts);
|
|
153053
154133
|
}
|
|
153054
154134
|
);
|
|
153055
154135
|
root.command("adgroup-entities").description(
|
|
153056
154136
|
"\u5E7F\u544A\u7EC4\u7EE9\u6548+\u7CFB\u5217\u76EE\u6807 CPA/\u5468\u9884\u7B97\uFF08GET /adgroups\uFF1B\u9ED8\u8BA4\u5168\u7F51\uFF1BCPA \u98D9\u5347\u770B\u8FD1 3 \u65E5\u533A\u95F4\u6C47\u603B\uFF0C\u4E0D\u8981\u4F20 timeIncrement\uFF09"
|
|
153057
|
-
).requiredOption(...
|
|
154137
|
+
).requiredOption(...ACCOUNT_OPTION5).option(...START_OPTION).option(...END_OPTION).option("--time-increment <n>", "\u4F20 1 \u6309\u65E5\u5207\u5206\uFF1B\u4E0D\u4F20=\u533A\u95F4\u6C47\u603B").option("--campaign-id <id>", "\u53EA\u62C9\u8BE5\u7CFB\u5217\u4E0B\u7684\u7EC4").option("--limit <n>", "\u6761\u6570\u4E0A\u9650\uFF08\u9ED8\u8BA4\u7F51\u5173 100\uFF0C\u6700\u5927 10000\uFF09", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
153058
154138
|
async (opts) => {
|
|
153059
154139
|
await runYandexAdGroupEntities(opts);
|
|
153060
154140
|
}
|
|
153061
154141
|
);
|
|
153062
154142
|
root.command("ad-entities").description(
|
|
153063
154143
|
`\u5E7F\u544A\u7EE9\u6548+\u843D\u5730\u9875/\u62D2\u5BA1\uFF08GET /ads\uFF1B\u62D2\u5BA1\u4F20 --status REJECTED\uFF1B\u5408\u6CD5\uFF1A${YANDEX_AD_STATUSES.join(",")}\uFF1B\u4E0E --time-increment \u4E92\u65A5\uFF09`
|
|
153064
|
-
).requiredOption(...
|
|
154144
|
+
).requiredOption(...ACCOUNT_OPTION5).option(...START_OPTION).option(...END_OPTION).option("--time-increment <n>", "\u4F20 1 \u6309\u65E5\u5207\u5206\uFF1B\u4E0D\u4F20=\u533A\u95F4\u6C47\u603B\u3002\u4E0D\u8981\u548C --status \u540C\u65F6\u4F20").option(
|
|
153065
154145
|
"--status <list>",
|
|
153066
154146
|
"\u5BA1\u6838\u6001\u9017\u53F7\u5206\u9694\uFF0C\u5982 REJECTED \u6216 MODERATION,REJECTED\uFF1B\u5E26 status \u65F6\u4E0D\u62C9\u7EE9\u6548\uFF08spend=0\uFF09"
|
|
153067
|
-
).option("--campaign-id <id>", "\u53EA\u62C9\u8BE5\u7CFB\u5217\u4E0B\u7684\u5E7F\u544A").option("--adgroup-id <id>", "\u53EA\u62C9\u8BE5\u7EC4\u4E0B\u7684\u5E7F\u544A").option("--limit <n>", "\u6761\u6570\u4E0A\u9650\uFF08\u9ED8\u8BA4\u7F51\u5173 100\uFF0C\u6700\u5927 10000\uFF09", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>",
|
|
154147
|
+
).option("--campaign-id <id>", "\u53EA\u62C9\u8BE5\u7CFB\u5217\u4E0B\u7684\u5E7F\u544A").option("--adgroup-id <id>", "\u53EA\u62C9\u8BE5\u7EC4\u4E0B\u7684\u5E7F\u544A").option("--limit <n>", "\u6761\u6570\u4E0A\u9650\uFF08\u9ED8\u8BA4\u7F51\u5173 100\uFF0C\u6700\u5927 10000\uFF09", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
153068
154148
|
async (opts) => {
|
|
153069
154149
|
await runYandexAdEntities(opts);
|
|
153070
154150
|
}
|
|
153071
154151
|
);
|
|
153072
154152
|
root.command("insights").description(
|
|
153073
154153
|
"YandexAPI \u62A5\u8868\u5207\u7247\uFF08GET /daily|/geo|/devices|/keywords \u6216 campaigns/adgroups/ads\uFF1B\u53EF\u542B\u4ECA\u5929\uFF1B\u65E0\u5C0F\u65F6\u7EF4\u5EA6\u3002geo/devices \u5168\u7F51\u987B --network ALL\uFF09"
|
|
153074
|
-
).requiredOption(...
|
|
154154
|
+
).requiredOption(...ACCOUNT_OPTION5).requiredOption("--level <level>", YANDEX_INSIGHTS_LEVELS.join(" / ")).option(...START_OPTION).option(...END_OPTION).option("--time-increment <n>", "\u4EC5 campaigns/adgroups/ads\uFF1A\u4F20 1 \u6309\u65E5\uFF1B\u4E0D\u8981\u548C --status \u540C\u65F6\u4F20").option("--network <value>", "\u4EC5 campaigns/geo/devices\uFF1ASEARCH \u6216 ALL").option("--status <list>", "\u4EC5 --level ads\uFF1A\u5BA1\u6838\u6001\u8FC7\u6EE4").option("--campaign-id <id>", "\u4EC5 adgroups/ads").option("--adgroup-id <id>", "\u4EC5 ads").option("--limit <n>", "\u6709 limit \u7684 path\uFF1A\u9ED8\u8BA4\u7F51\u5173 100\uFF0C\u6700\u5927 10000", (v) => parseInt(v, 10)).option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
153075
154155
|
async (opts) => {
|
|
153076
154156
|
await runYandexInsights(opts);
|
|
153077
154157
|
}
|
|
153078
154158
|
);
|
|
153079
|
-
root.command("campaign-state").description("\u6682\u505C\u6216\u6062\u590D\u7CFB\u5217\uFF08Direct campaigns.suspend / campaigns.resume\uFF09").requiredOption(...
|
|
154159
|
+
root.command("campaign-state").description("\u6682\u505C\u6216\u6062\u590D\u7CFB\u5217\uFF08Direct campaigns.suspend / campaigns.resume\uFF09").requiredOption(...ACCOUNT_OPTION5).requiredOption("--campaign-id <id>", "\u7CFB\u5217 ID").requiredOption("--action <action>", "suspend \u6216 resume").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
153080
154160
|
await runYandexCampaignState(opts);
|
|
153081
154161
|
});
|
|
153082
|
-
root.command("campaign-budget").description("\u6539\u7CFB\u5217\u65E5\u9884\u7B97\uFF08Direct campaigns.update DailyBudget\uFF1B\u91D1\u989D\u662F\u8D26\u6237\u5E01\u79CD\uFF0C\u7F51\u5173\u6362\u7B97 micros\uFF09").requiredOption(...
|
|
154162
|
+
root.command("campaign-budget").description("\u6539\u7CFB\u5217\u65E5\u9884\u7B97\uFF08Direct campaigns.update DailyBudget\uFF1B\u91D1\u989D\u662F\u8D26\u6237\u5E01\u79CD\uFF0C\u7F51\u5173\u6362\u7B97 micros\uFF09").requiredOption(...ACCOUNT_OPTION5).requiredOption("--campaign-id <id>", "\u7CFB\u5217 ID").requiredOption("--daily-budget <amount>", "\u65E5\u9884\u7B97\uFF0C\u8D26\u6237\u5E01\u79CD\uFF0C\u5FC5\u987B\u5927\u4E8E 0").option("--mode <mode>", "STANDARD\uFF08\u9ED8\u8BA4\uFF09\u6216 DISTRIBUTED").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
153083
154163
|
await runYandexCampaignBudget(opts);
|
|
153084
154164
|
});
|
|
153085
|
-
root.command("adgroup-state").description("\u5E7F\u544A\u7EC4\u4E0D\u80FD\u5355\u72EC\u542F\u505C\uFF08Direct \u7684 AdGroups \u6CA1\u6709 suspend/resume\uFF1B\u8BF7\u7528 ad-state \u6216 campaign-state\uFF09").requiredOption(...
|
|
154165
|
+
root.command("adgroup-state").description("\u5E7F\u544A\u7EC4\u4E0D\u80FD\u5355\u72EC\u542F\u505C\uFF08Direct \u7684 AdGroups \u6CA1\u6709 suspend/resume\uFF1B\u8BF7\u7528 ad-state \u6216 campaign-state\uFF09").requiredOption(...ACCOUNT_OPTION5).requiredOption("--adgroup-id <id>", "\u5E7F\u544A\u7EC4 ID").requiredOption("--action <action>", "suspend \u6216 resume").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
153086
154166
|
await runYandexAdGroupState({ ...opts, adGroupId: opts.adgroupId });
|
|
153087
154167
|
});
|
|
153088
|
-
root.command("ad-state").description("\u6682\u505C\u6216\u6062\u590D\u5E7F\u544A\uFF08Direct ads.suspend / ads.resume\uFF09").requiredOption(...
|
|
154168
|
+
root.command("ad-state").description("\u6682\u505C\u6216\u6062\u590D\u5E7F\u544A\uFF08Direct ads.suspend / ads.resume\uFF09").requiredOption(...ACCOUNT_OPTION5).requiredOption("--ad-id <id>", "\u5E7F\u544A ID").requiredOption("--action <action>", "suspend \u6216 resume").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
153089
154169
|
await runYandexAdState(opts);
|
|
153090
154170
|
});
|
|
153091
|
-
root.command("keyword-bid").description("\u6539\u5173\u952E\u8BCD\u641C\u7D22\u51FA\u4EF7\uFF08Direct keywordbids.set SearchBid\uFF1B\u91D1\u989D\u662F\u8D26\u6237\u5E01\u79CD\uFF09").requiredOption(...
|
|
154171
|
+
root.command("keyword-bid").description("\u6539\u5173\u952E\u8BCD\u641C\u7D22\u51FA\u4EF7\uFF08Direct keywordbids.set SearchBid\uFF1B\u91D1\u989D\u662F\u8D26\u6237\u5E01\u79CD\uFF09").requiredOption(...ACCOUNT_OPTION5).requiredOption("--keyword-id <id>", "\u5173\u952E\u8BCD ID").requiredOption("--search-bid <amount>", "\u641C\u7D22\u51FA\u4EF7\uFF0C\u8D26\u6237\u5E01\u79CD\uFF0C\u5FC5\u987B\u5927\u4E8E 0").option("-t, --token <token>", "Auth Token").option("--json-out <path>", JSON_OUT_OPTION_DESC5).option("--verbose", "\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
153092
154172
|
await runYandexKeywordBid(opts);
|
|
153093
154173
|
});
|
|
153094
154174
|
}
|
|
@@ -153134,7 +154214,6 @@ var BING_COVERAGE_WRITES = [
|
|
|
153134
154214
|
"hotel-length-of-stay",
|
|
153135
154215
|
"hotel-date-selection",
|
|
153136
154216
|
"product-ad",
|
|
153137
|
-
"responsive-ad",
|
|
153138
154217
|
"hotel-ad",
|
|
153139
154218
|
"app-install-ad",
|
|
153140
154219
|
"update-responsive-ad",
|
|
@@ -153566,7 +154645,9 @@ var GAP_ACTIONS = {
|
|
|
153566
154645
|
"bing.delete-campaigns": bing("campaigns/delete"),
|
|
153567
154646
|
"bing.ad-group": bing("ad-groups"),
|
|
153568
154647
|
"bing.delete-ad-groups": bing("ad-groups/delete"),
|
|
154648
|
+
// 搜索响应式广告走 library/ads。受众广告是 bing.responsive-audience-ad。
|
|
153569
154649
|
"bing.responsive-ad": bing("ads"),
|
|
154650
|
+
"bing.responsive-audience-ad": bing("coverage/responsive-ad"),
|
|
153570
154651
|
"bing.delete-ads": bing("ads/delete"),
|
|
153571
154652
|
"bing.keywords": bing("keywords"),
|
|
153572
154653
|
"bing.keyword-bids": bing("keywords/bids"),
|
|
@@ -153714,6 +154795,88 @@ var GAP_ACTIONS = {
|
|
|
153714
154795
|
"tiktok.ad-group": tiktok("ad-groups"),
|
|
153715
154796
|
"tiktok.ad": tiktok("ads"),
|
|
153716
154797
|
"tiktok.smart-creative": tiktok("smart-creatives"),
|
|
154798
|
+
"tiktok.rename-campaign": tiktok("campaign-names"),
|
|
154799
|
+
"tiktok.rename-ad-group": tiktok("ad-group-names"),
|
|
154800
|
+
"tiktok.rename-ad": tiktok("ad-names"),
|
|
154801
|
+
"tiktok.rename-advertiser": tiktok("advertiser-names"),
|
|
154802
|
+
"tiktok.video-library": tiktok("video-library"),
|
|
154803
|
+
"tiktok.image-library": tiktok("image-library"),
|
|
154804
|
+
"tiktok.suggest-cover": tiktok("suggest-covers"),
|
|
154805
|
+
"tiktok.lookalike": tiktok("lookalikes"),
|
|
154806
|
+
"tiktok.refresh-lookalike": tiktok("lookalikes/refresh"),
|
|
154807
|
+
"tiktok.audience-detail": tiktok("audiences/detail"),
|
|
154808
|
+
"tiktok.audience-overlap": tiktok("audiences/overlap"),
|
|
154809
|
+
"tiktok.diagnosis": tiktok("diagnosis"),
|
|
154810
|
+
"tiktok.creative-fatigue": tiktok("creative-fatigue"),
|
|
154811
|
+
"tiktok.search-keywords": tiktok("search-keywords"),
|
|
154812
|
+
"tiktok.keyword-ideas": tiktok("keyword-ideas"),
|
|
154813
|
+
"tiktok.search-health": tiktok("search-health"),
|
|
154814
|
+
"tiktok.negative-keyword-list": tiktok("negative-keywords/list"),
|
|
154815
|
+
"tiktok.delete-negative-keywords": tiktok("negative-keywords/delete"),
|
|
154816
|
+
"tiktok.read-campaigns": tiktok("campaigns/raw"),
|
|
154817
|
+
"tiktok.read-ad-groups": tiktok("ad-groups/raw"),
|
|
154818
|
+
"tiktok.read-ads": tiktok("ads/raw"),
|
|
154819
|
+
"tiktok.smart-plus-ad-group": tiktok("smart-plus/ad-groups"),
|
|
154820
|
+
"tiktok.smart-plus-ad": tiktok("smart-plus/ads"),
|
|
154821
|
+
"tiktok.smart-plus-campaign-status": tiktok("smart-plus/campaign-status"),
|
|
154822
|
+
"tiktok.smart-plus-ad-group-status": tiktok("smart-plus/ad-group-status"),
|
|
154823
|
+
"tiktok.smart-plus-ad-status": tiktok("smart-plus/ad-status"),
|
|
154824
|
+
"tiktok.read-smart-creative": tiktok("smart-creatives/raw"),
|
|
154825
|
+
"tiktok.update-smart-creative": tiktok("smart-creatives/update"),
|
|
154826
|
+
"tiktok.catalog": tiktok("catalogs"),
|
|
154827
|
+
"tiktok.update-catalog": tiktok("catalogs/update"),
|
|
154828
|
+
"tiktok.delete-catalog": tiktok("catalogs/delete"),
|
|
154829
|
+
"tiktok.read-catalogs": tiktok("catalogs/list"),
|
|
154830
|
+
"tiktok.catalog-countries": tiktok("catalog-countries"),
|
|
154831
|
+
"tiktok.catalog-products": tiktok("catalog-products"),
|
|
154832
|
+
"tiktok.catalog-product-log": tiktok("catalog-product-logs"),
|
|
154833
|
+
"tiktok.catalog-set": tiktok("catalog-sets"),
|
|
154834
|
+
"tiktok.read-catalog-sets": tiktok("catalog-sets/list"),
|
|
154835
|
+
"tiktok.catalog-feed": tiktok("catalog-feeds"),
|
|
154836
|
+
"tiktok.read-catalog-feeds": tiktok("catalog-feeds/list"),
|
|
154837
|
+
"tiktok.catalog-diagnosis": tiktok("catalog-diagnosis"),
|
|
154838
|
+
"tiktok.catalog-overview": tiktok("catalog-overviews"),
|
|
154839
|
+
"tiktok.catalog-event-bind": tiktok("catalog-events"),
|
|
154840
|
+
"tiktok.store-products": tiktok("store-products"),
|
|
154841
|
+
"tiktok.read-gmv-max": tiktok("gmv-max/info"),
|
|
154842
|
+
"tiktok.update-gmv-max": tiktok("gmv-max/update"),
|
|
154843
|
+
"tiktok.gmv-max-stores": tiktok("gmv-max/stores"),
|
|
154844
|
+
"tiktok.gmv-max-report": tiktok("gmv-max/report"),
|
|
154845
|
+
"tiktok.rule": tiktok("rules"),
|
|
154846
|
+
"tiktok.update-rule": tiktok("rules/update"),
|
|
154847
|
+
"tiktok.rule-status": tiktok("rules/status"),
|
|
154848
|
+
"tiktok.read-rules": tiktok("rules/list"),
|
|
154849
|
+
"tiktok.rule-results": tiktok("rules/results"),
|
|
154850
|
+
"tiktok.comments": tiktok("comments"),
|
|
154851
|
+
"tiktok.comment-reply": tiktok("comments/reply"),
|
|
154852
|
+
"tiktok.blocked-words": tiktok("blocked-words"),
|
|
154853
|
+
"tiktok.create-blocked-words": tiktok("blocked-words/create"),
|
|
154854
|
+
"tiktok.delete-blocked-words": tiktok("blocked-words/delete"),
|
|
154855
|
+
"tiktok.spark-auth": tiktok("spark/authorize"),
|
|
154856
|
+
"tiktok.spark-posts": tiktok("spark/posts"),
|
|
154857
|
+
"tiktok.spark-unbind": tiktok("spark/unbind"),
|
|
154858
|
+
"tiktok.playables": tiktok("playables"),
|
|
154859
|
+
"tiktok.report-task": tiktok("report-tasks"),
|
|
154860
|
+
"tiktok.report-task-check": tiktok("report-tasks/check"),
|
|
154861
|
+
"tiktok.copy-task": tiktok("copy-tasks"),
|
|
154862
|
+
"tiktok.update-split-test": tiktok("split-tests/update"),
|
|
154863
|
+
"tiktok.end-split-test": tiktok("split-tests/end"),
|
|
154864
|
+
"tiktok.split-test-result": tiktok("split-tests/result"),
|
|
154865
|
+
"tiktok.promote-split-test": tiktok("split-tests/promote"),
|
|
154866
|
+
"tiktok.saved-audience": tiktok("saved-audiences"),
|
|
154867
|
+
"tiktok.read-saved-audiences": tiktok("saved-audiences/list"),
|
|
154868
|
+
"tiktok.delete-saved-audience": tiktok("saved-audiences/delete"),
|
|
154869
|
+
"tiktok.update-pixel": tiktok("pixels/update"),
|
|
154870
|
+
"tiktok.delete-pixel": tiktok("pixels/delete"),
|
|
154871
|
+
"tiktok.update-pixel-event": tiktok("pixel-events/update"),
|
|
154872
|
+
"tiktok.delete-pixel-event": tiktok("pixel-events/delete"),
|
|
154873
|
+
"tiktok.custom-conversion": tiktok("custom-conversions"),
|
|
154874
|
+
"tiktok.read-custom-conversions": tiktok("custom-conversions/list"),
|
|
154875
|
+
"tiktok.update-custom-conversion": tiktok("custom-conversions/update"),
|
|
154876
|
+
"tiktok.delete-custom-conversion": tiktok("custom-conversions/delete"),
|
|
154877
|
+
"tiktok.ad-review": tiktok("ad-reviews"),
|
|
154878
|
+
"tiktok.ad-group-review": tiktok("ad-group-reviews"),
|
|
154879
|
+
"tiktok.ad-appeal": tiktok("ad-appeals"),
|
|
153717
154880
|
"meta.outcome-campaign": facebook("outcome-campaigns"),
|
|
153718
154881
|
"meta.outcome-campaign-update": facebook("outcome-campaigns/{id}", { needsId: true }),
|
|
153719
154882
|
"meta.advantage-campaign": facebook("advantage-campaigns"),
|
|
@@ -153736,6 +154899,8 @@ var GAP_ACTIONS = {
|
|
|
153736
154899
|
needsBody: false
|
|
153737
154900
|
}),
|
|
153738
154901
|
"google.customer-match-list": google("POST", "/customer-match/{account}/user-lists"),
|
|
154902
|
+
"google.lookalike-list": google("POST", "/lookalike-user-lists/{account}?seedUserListId={id}", { needsId: true }),
|
|
154903
|
+
"google.ga4-link": google("POST", "/ga4-links/{account}"),
|
|
153739
154904
|
"google.remove-customer-match-list": google("DELETE", "/customer-match/{account}/user-lists/{id}", { needsId: true, needsBody: false }),
|
|
153740
154905
|
"google.customer-match-job": google("POST", "/customer-match/{account}/jobs?userListId={id}", { needsId: true, needsBody: false }),
|
|
153741
154906
|
"google.customer-match-operations": google("POST", "/customer-match/{account}/jobs/{id}/operations", { needsId: true }),
|
|
@@ -153850,9 +155015,6 @@ function resolveGapPath(actionName, target) {
|
|
|
153850
155015
|
if (!action) {
|
|
153851
155016
|
throw new Error(`\u672A\u77E5 action\uFF1A${actionName}`);
|
|
153852
155017
|
}
|
|
153853
|
-
if (action.service === "tiktok" && action.path.toLowerCase().includes("catalog")) {
|
|
153854
|
-
throw new Error("\u5546\u54C1\u76EE\u5F55\u8DEF\u5F84\u672A\u63A5\u5165");
|
|
153855
|
-
}
|
|
153856
155018
|
const account = requireToken(target.account, "account");
|
|
153857
155019
|
const parent = action.needsParent ? requireToken(target.parent, "parent") : target.parent?.trim() ?? "";
|
|
153858
155020
|
const id = action.needsId ? requireToken(target.id, "id") : target.id?.trim() ?? "";
|
|
@@ -153884,7 +155046,7 @@ function requireToken(value, label2) {
|
|
|
153884
155046
|
init_auth();
|
|
153885
155047
|
init_cli_json_snapshot();
|
|
153886
155048
|
init_shared();
|
|
153887
|
-
import { readFileSync as
|
|
155049
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
153888
155050
|
function readGapBody(opts, required) {
|
|
153889
155051
|
const inline = opts.body?.trim();
|
|
153890
155052
|
const file = opts.bodyFile?.trim();
|
|
@@ -153895,7 +155057,7 @@ function readGapBody(opts, required) {
|
|
|
153895
155057
|
if (!required) return void 0;
|
|
153896
155058
|
throw new Error("\u8FD9\u4E2A action \u9700\u8981 --body \u6216 --body-file");
|
|
153897
155059
|
}
|
|
153898
|
-
const raw = file ?
|
|
155060
|
+
const raw = file ? readFileSync22(file, "utf8") : inline;
|
|
153899
155061
|
let parsed;
|
|
153900
155062
|
try {
|
|
153901
155063
|
parsed = JSON.parse(raw);
|
|
@@ -154291,7 +155453,7 @@ configureCliJsonSnapshot({
|
|
|
154291
155453
|
configureSiluzanClientIdentity({ client: "tso-cli", resolveVersion: getVersion });
|
|
154292
155454
|
var program = new Command6();
|
|
154293
155455
|
program.name("siluzan-tso").description(
|
|
154294
|
-
"Siluzan \u5E7F\u544A\u8D26\u6237\u7BA1\u7406\uFF1A\u8D26\u6237\u67E5\u8BE2\u3001\u4F59\u989D\u3001\u6295\u653E\u6570\u636E\u3001\u5F00\u6237\u7533\u8BF7\uFF08Google/TikTok/Yandex/Bing/Meta\uFF09\u3001\n\u8D26\u53F7\u5206\u4EAB/\u89E3\u7ED1\u3001\u4F18\u5316\u62A5\u544A\u3001Google/Meta/TikTok/Bing/Yandex \u8D26\u6237\u5206\u6790\u3001Google \u5E7F\u544A\u8BCA\u65AD\u62A5\u544A\uFF08google-ads-diagnosis render\uFF09\u3001Google \u5B63\u5EA6\u7ECF\u8425\u62A5\u544A\uFF08google-quarterly\uFF09\u3001\u7F51\u7AD9\u8BCA\u65AD\uFF08website-diagnosis\uFF09\u3001\u6218\u7565\u5E02\u573A\u5206\u6790\uFF08market-analysis\uFF0CAgent \u751F\u6210\u62A5\u544A\uFF09\u3001\u5145\u503C\u8F6C\u8D26\u3001\u5F00\u7968\u3001\u667A\u80FD\u9884\u8B66\u3001Google \u5E7F\u544A\u7BA1\u7406\uFF08Search/PMax\uFF0C\u542B\u5F02\u6B65\u6279\u91CF\uFF09\u3001Meta Instant Form \u7EBF\u7D22\u5E7F\u544A\uFF08meta-ad\uFF09\u3001Bing/Yandex/TikTok \u542F\u505C\u4E0E\u9884\u7B97\u3002"
|
|
155456
|
+
"Siluzan \u5E7F\u544A\u8D26\u6237\u7BA1\u7406\uFF1A\u8D26\u6237\u67E5\u8BE2\u3001\u4F59\u989D\u3001\u6295\u653E\u6570\u636E\u3001\u5F00\u6237\u7533\u8BF7\uFF08Google/TikTok/Yandex/Bing/Meta\uFF09\u3001\n\u8D26\u53F7\u5206\u4EAB/\u89E3\u7ED1\u3001\u4F18\u5316\u62A5\u544A\u3001Google/Meta/TikTok/Bing/Yandex \u8D26\u6237\u5206\u6790\u3001GA4 \u6307\u6807\uFF08ga4\uFF09\u3001Google \u5E7F\u544A\u8BCA\u65AD\u62A5\u544A\uFF08google-ads-diagnosis render\uFF09\u3001Google \u5B63\u5EA6\u7ECF\u8425\u62A5\u544A\uFF08google-quarterly\uFF09\u3001\u7F51\u7AD9\u8BCA\u65AD\uFF08website-diagnosis\uFF09\u3001\u6218\u7565\u5E02\u573A\u5206\u6790\uFF08market-analysis\uFF0CAgent \u751F\u6210\u62A5\u544A\uFF09\u3001\u5145\u503C\u8F6C\u8D26\u3001\u5F00\u7968\u3001\u667A\u80FD\u9884\u8B66\u3001Google \u5E7F\u544A\u7BA1\u7406\uFF08Search/PMax\uFF0C\u542B\u5F02\u6B65\u6279\u91CF\uFF09\u3001Meta Instant Form \u7EBF\u7D22\u5E7F\u544A\uFF08meta-ad\uFF09\u3001Bing/Yandex/TikTok \u542F\u505C\u4E0E\u9884\u7B97\u3002"
|
|
154295
155457
|
).version(getVersion());
|
|
154296
155458
|
program.option("--commit <text>", "\u5199\u64CD\u4F5C\u8BF4\u660E\uFF1B\u8BB0\u5165\u672C\u673A\u5199\u5BA1\u8BA1 JSONL");
|
|
154297
155459
|
program.hook("preAction", async () => {
|
|
@@ -154322,6 +155484,7 @@ var REGISTRARS = [
|
|
|
154322
155484
|
register13,
|
|
154323
155485
|
register14,
|
|
154324
155486
|
registerGoogleAnalysisCommands,
|
|
155487
|
+
register28,
|
|
154325
155488
|
registerGoogleAnalysisBatchCommands,
|
|
154326
155489
|
registerFacebookAnalysisCommands,
|
|
154327
155490
|
registerBingAnalysisCommands,
|