@gobing-ai/knowledge-kit 0.1.14 → 0.1.16
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/.claude-plugin/marketplace.json +1 -1
- package/dist/index.js +2399 -177
- package/package.json +1 -1
- package/plugins/generations/content-gen/dist/index.js +60 -54
- package/plugins/generations/content-gen/src/storm.ts +94 -61
- package/plugins/generations/core-facts-gen/dist/index.js +3 -3
- package/plugins/generations/daily-article-gen/dist/index.js +3 -3
- package/plugins/generations/dailynews-gen/dist/index.js +73 -10
- package/plugins/generations/dailynews-gen/src/index.ts +23 -1
- package/plugins/generations/dailynews-gen/src/script-plan.ts +103 -5
- package/plugins/generations/episode-plan-gen/dist/index.js +3 -3
- package/plugins/generations/gemini-tts/dist/index.js +3 -3
- package/plugins/generations/image-gen/README.md +31 -10
- package/plugins/generations/image-gen/assets/sample/cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__clean-webapp-ui.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__cute.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__daily-news.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__editorial.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__fresh.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__minimalist.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__photorealistic.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__sketch.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__technical-diagram.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__vibrant.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__warm.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__xhs-knowledge.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/free__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/illustration__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/xhs-card__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/dist/index.js +3 -3
- package/plugins/generations/image-gen/presets/formats/daily-news-podcast-cover.yaml +18 -0
- package/plugins/generations/image-gen/presets/styles/quasi-news-podcast.yaml +9 -0
- package/plugins/generations/news-report-gen/dist/index.js +3 -3
- package/plugins/generations/voice-gen/dist/index.js +3 -3
- package/plugins/generations/voxcpm-tts/dist/index.js +3 -3
- package/plugins/ingestions/aihot-ingest/dist/index.js +3 -3
- package/plugins/ingestions/horizon-ingest/dist/index.js +3 -3
- package/plugins/ingestions/last30days-ingest/dist/index.js +3 -3
- package/plugins/ingestions/web-search/dist/index.js +3 -3
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice-migration.json +12 -3
- package/plugins/kk/publish-presets/daily-ai-voice.json +11 -3
- package/plugins/kk/scripts/cover-compositor.ts +152 -0
- package/plugins/kk/scripts/daily-cover-mock.ts +164 -0
- package/plugins/kk/scripts/daily-scheduled-run.ts +192 -3
- package/plugins/kk/scripts/daily-stages.ts +599 -27
- package/plugins/kk/scripts/daily-triage-core.ts +451 -0
- package/plugins/kk/scripts/daily-triage.ts +74 -0
- package/plugins/kk/scripts/kk-workflow-stages.ts +51 -6
- package/plugins/kk/skills/content-judge/SKILL.md +5 -4
- package/plugins/kk/skills/content-judge/references/rubrics.md +14 -0
- package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +16 -10
- package/plugins/kk/skills/news-editorial/SKILL.md +122 -0
- package/plugins/kk/skills/news-editorial/references/selection.md +47 -0
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +100 -0
- package/plugins/kk/skills/publish/SKILL.md +4 -4
- package/plugins/kk/skills/web-automation/SKILL.md +229 -77
- package/plugins/kk/skills/web-automation/references/browser-launch.md +127 -36
- package/plugins/kk/skills/wiki-authoring/SKILL.md +53 -0
- package/plugins/kk/skills/wiki-authoring/references/page-shapes.md +44 -0
- package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -6
- package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +185 -224
- package/plugins/kk/workflows/kk-daily-publish3.yaml +16 -8
- package/plugins/kk/workflows/kk-daily-safety.yaml +32 -7
- package/plugins/publishings/bilibili-pub/dist/index.js +6 -4
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/cnblogs-pub/dist/index.js +6 -4
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/csdn-pub/dist/index.js +6 -4
- package/plugins/publishings/csdn-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/emdash-pub/dist/index.js +3 -3
- package/plugins/publishings/infoq-pub/dist/index.js +6 -4
- package/plugins/publishings/infoq-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/jike-pub/dist/index.js +6 -4
- package/plugins/publishings/jike-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/juejin-pub/dist/index.js +6 -4
- package/plugins/publishings/juejin-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/linkedin-pub/dist/index.js +6 -4
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/medium-pub/dist/index.js +3 -3
- package/plugins/publishings/podcast-pub/dist/index.js +148 -5
- package/plugins/publishings/podcast-pub/src/index.ts +71 -2
- package/plugins/publishings/podcast-pub/src/map.ts +3 -0
- package/plugins/publishings/podcast-pub/src/transcript.ts +195 -0
- package/plugins/publishings/qiita-pub/dist/index.js +3 -3
- package/plugins/publishings/shipinhao-pub/dist/index.js +227 -53
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +51 -2
- package/plugins/publishings/shipinhao-pub/plugin.json +2 -2
- package/plugins/publishings/shipinhao-pub/src/flow.ts +335 -79
- package/plugins/publishings/shipinhao-pub/src/index.ts +16 -8
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +1 -1
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +103 -5
- package/plugins/publishings/sspai-pub/dist/index.js +6 -4
- package/plugins/publishings/sspai-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/substack-pub/dist/index.js +6 -4
- package/plugins/publishings/substack-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/surfdash-pub/dist/index.js +237 -14
- package/plugins/publishings/surfdash-pub/src/index.ts +127 -6
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +189 -0
- package/plugins/publishings/threads-pub/dist/index.js +3 -3
- package/plugins/publishings/wechatmp-pub/dist/index.js +62 -40
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +10 -3
- package/plugins/publishings/wechatmp-pub/src/flow.ts +73 -37
- package/plugins/publishings/wechatmp-pub/src/page.ts +14 -0
- package/plugins/publishings/weibo-pub/dist/index.js +6 -4
- package/plugins/publishings/weibo-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/x-pub/dist/index.js +6 -4
- package/plugins/publishings/x-pub/dist/profile-check.js +6 -4
- package/plugins/publishings/xhs-pub/dist/index.js +562 -34
- package/plugins/publishings/xhs-pub/dist/profile-check.js +25 -4
- package/plugins/publishings/xhs-pub/src/errors.ts +45 -0
- package/plugins/publishings/xhs-pub/src/flow.ts +773 -45
- package/plugins/publishings/xhs-pub/src/page.ts +33 -0
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +6 -4
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +3 -1
- package/plugins/publishings/zenn-pub/dist/index.js +3 -3
- package/plugins/kk/scripts/daily-voice-style.zh.md +0 -70
|
@@ -19905,7 +19905,7 @@ var PLATFORM_CONTENT_LIMITS = Object.freeze({
|
|
|
19905
19905
|
shortVideo: Object.freeze({
|
|
19906
19906
|
douyin: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19907
19907
|
kuaishou: Object.freeze({ max: 1000, unit: "unicode_code_points" }),
|
|
19908
|
-
shipinhao: Object.freeze({ max:
|
|
19908
|
+
shipinhao: Object.freeze({ max: 100, unit: "unicode_code_points" })
|
|
19909
19909
|
})
|
|
19910
19910
|
})
|
|
19911
19911
|
});
|
|
@@ -20073,11 +20073,11 @@ var PluginManifestSchemaBase = looseObject({
|
|
|
20073
20073
|
});
|
|
20074
20074
|
var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx) => {
|
|
20075
20075
|
if (manifest.browserSession !== undefined) {
|
|
20076
|
-
if (manifest.kind !== "publish") {
|
|
20076
|
+
if (manifest.kind !== "publish" && manifest.kind !== "ingestion") {
|
|
20077
20077
|
ctx.addIssue({
|
|
20078
20078
|
code: "custom",
|
|
20079
20079
|
path: ["browserSession"],
|
|
20080
|
-
message: `browserSession requires kind "publish", not "${manifest.kind}"`
|
|
20080
|
+
message: `browserSession requires kind "publish" or "ingestion", not "${manifest.kind}"`
|
|
20081
20081
|
});
|
|
20082
20082
|
}
|
|
20083
20083
|
if (manifest.check === undefined) {
|
|
@@ -20683,10 +20683,12 @@ function sha256Hex(value) {
|
|
|
20683
20683
|
var DEFAULT_BOT_PROFILE_ROOT = join4(homedir4(), ".config", "kk", "browser-profiles");
|
|
20684
20684
|
class BotError extends Error {
|
|
20685
20685
|
code;
|
|
20686
|
-
|
|
20686
|
+
details;
|
|
20687
|
+
constructor(code, message, details = {}) {
|
|
20687
20688
|
super(message);
|
|
20688
20689
|
this.name = "BotError";
|
|
20689
20690
|
this.code = code;
|
|
20691
|
+
this.details = details;
|
|
20690
20692
|
}
|
|
20691
20693
|
}
|
|
20692
20694
|
// ../../packages/publish-harness/src/profile-dir.ts
|
|
@@ -20873,7 +20875,21 @@ function errorMessage2(error) {
|
|
|
20873
20875
|
|
|
20874
20876
|
// ../../plugins/publishings/shipinhao-pub/src/selectors.ts
|
|
20875
20877
|
var SHP_TARGET = "shipinhao";
|
|
20876
|
-
var SHP_HOME_URL = "https://channels.weixin.qq.com/platform
|
|
20878
|
+
var SHP_HOME_URL = "https://channels.weixin.qq.com/platform";
|
|
20879
|
+
var SHP_OPERATION_NAMES = ["shortVideo", "audio", "image", "music"];
|
|
20880
|
+
var SHP_CREATE_ENTRY_SELECTORS = ['button:text-is("\u53D1\u8868\u89C6\u9891")'];
|
|
20881
|
+
var SHP_DESCRIPTION_MAX_CHARS = 100;
|
|
20882
|
+
var SHP_DRAFT_CONFIRM_DIALOG_TEXT = "\u4F7F\u7528\u5B9A\u65F6\u53D1\u8868\u5C06\u65E0\u6CD5\u4FDD\u5B58\u8349\u7A3F";
|
|
20883
|
+
var SHP_DRAFT_CONFIRM_PROCEED_LABEL = "\u4FDD\u5B58";
|
|
20884
|
+
var SHP_AUDIO_HOME_URL = SHP_HOME_URL;
|
|
20885
|
+
var SHP_IMAGE_HOME_URL = SHP_HOME_URL;
|
|
20886
|
+
var SHP_MUSIC_HOME_URL = SHP_HOME_URL;
|
|
20887
|
+
var SHP_HOME_URL_BY_OPERATION = {
|
|
20888
|
+
shortVideo: SHP_HOME_URL,
|
|
20889
|
+
audio: SHP_AUDIO_HOME_URL,
|
|
20890
|
+
image: SHP_IMAGE_HOME_URL,
|
|
20891
|
+
music: SHP_MUSIC_HOME_URL
|
|
20892
|
+
};
|
|
20877
20893
|
var SHP_LOGIN_URL_RE = /(open\.weixin\.qq\.com|channels\.weixin\.qq\.com\/platform\/(login|scan))/;
|
|
20878
20894
|
var ROOT_SNAPSHOT_SCRIPT = `(() => { // kk-shp-root-snapshot
|
|
20879
20895
|
const wujieApp = document.querySelector('wujie-app');
|
|
@@ -20910,6 +20926,7 @@ async function readRootSnapshot(page) {
|
|
|
20910
20926
|
var SHP_ROOT_WAIT_MS = 30000;
|
|
20911
20927
|
var SHP_COVER_SAVE_WAIT_MS = 60000;
|
|
20912
20928
|
var SHP_VIDEO_SELECTORS = {
|
|
20929
|
+
createEntry: SHP_CREATE_ENTRY_SELECTORS,
|
|
20913
20930
|
videoInput: [
|
|
20914
20931
|
'input[type="file"][accept*="video"]',
|
|
20915
20932
|
'input[type="file"][accept*=".mp4"]',
|
|
@@ -20940,9 +20957,26 @@ var SHP_VIDEO_SELECTORS = {
|
|
|
20940
20957
|
saveButton: ['button:text-is("\u4FDD\u5B58\u8349\u7A3F")'],
|
|
20941
20958
|
publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")']
|
|
20942
20959
|
};
|
|
20960
|
+
var SHP_AUDIO_SELECTORS = {
|
|
20961
|
+
...SHP_VIDEO_SELECTORS,
|
|
20962
|
+
audioInput: ['input[type="file"][accept*="video"]', 'input[type="file"]']
|
|
20963
|
+
};
|
|
20964
|
+
var SHP_MUSIC_SELECTORS = { ...SHP_AUDIO_SELECTORS };
|
|
20965
|
+
var SHP_IMAGE_SELECTORS = {
|
|
20966
|
+
...SHP_VIDEO_SELECTORS,
|
|
20967
|
+
imagesInput: [
|
|
20968
|
+
'input[type="file"][multiple]',
|
|
20969
|
+
'input[type="file"][accept*="image"]',
|
|
20970
|
+
'section:has(input[type="file"]):has-text("\u4E0A\u4F20\u56FE\u7247") input[type="file"]',
|
|
20971
|
+
'input[type="file"]'
|
|
20972
|
+
]
|
|
20973
|
+
};
|
|
20943
20974
|
var SHP_RECEIPT_URL_RES = [
|
|
20944
20975
|
/channels\.weixin\.qq\.com\/platform\/record\/detail\/[0-9a-zA-Z_-]+/,
|
|
20945
|
-
/channels\.weixin\.qq\.com\/platform\/post\/video\/[0-9a-zA-Z_-]
|
|
20976
|
+
/channels\.weixin\.qq\.com\/platform\/post\/video\/[0-9a-zA-Z_-]+/,
|
|
20977
|
+
/channels\.weixin\.qq\.com\/platform\/post\/audio\/[0-9a-zA-Z_-]+/,
|
|
20978
|
+
/channels\.weixin\.qq\.com\/platform\/post\/image\/[0-9a-zA-Z_-]+/,
|
|
20979
|
+
/channels\.weixin\.qq\.com\/platform\/post\/music\/[0-9a-zA-Z_-]+/
|
|
20946
20980
|
];
|
|
20947
20981
|
var SHP_UPLOAD_TIMEOUT_MS = 600000;
|
|
20948
20982
|
var SHP_LOGIN_TIMEOUT_MS = 180000;
|
|
@@ -20996,6 +21030,20 @@ function needsLogin(error) {
|
|
|
20996
21030
|
function normalizeText(value) {
|
|
20997
21031
|
return value.replace(/\s+/g, "");
|
|
20998
21032
|
}
|
|
21033
|
+
function htmlToPlainText(html) {
|
|
21034
|
+
return html.replace(/<\/(p|h[1-6]|li|blockquote|div)>/gi, `
|
|
21035
|
+
`).replace(/<br\s*\/?>/gi, `
|
|
21036
|
+
`).replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").trim();
|
|
21037
|
+
}
|
|
21038
|
+
function buildShipinhaoDescription(body, tags) {
|
|
21039
|
+
const bodyPlain = htmlToPlainText(sanitizeShipinhaoHtml(markdownToHtml(body)));
|
|
21040
|
+
const topicLine = tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ");
|
|
21041
|
+
const budget = SHP_DESCRIPTION_MAX_CHARS - (tags.length > 0 ? Array.from(topicLine).length + 1 : 0);
|
|
21042
|
+
const clipped = Array.from(bodyPlain).slice(0, Math.max(budget, 0)).join("").trim();
|
|
21043
|
+
const description = tags.length > 0 ? `${clipped}
|
|
21044
|
+
${topicLine}` : clipped;
|
|
21045
|
+
return { description, html: sanitizeShipinhaoHtml(markdownToHtml(description)) };
|
|
21046
|
+
}
|
|
20999
21047
|
function sanitizeShipinhaoHtml(html) {
|
|
21000
21048
|
return html.replace(/<\s*(script|style|iframe|embed|object)\b[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*(script|style|iframe|embed|object)\b[^>]*>/gi, "").replace(/\son[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/(\s(?:href|src)\s*=\s*)(["'])\s*(?:javascript|data):[^"']*\2/gi, "$1$2$2").replace(/(\s(?:href|src)\s*=\s*)(?:javascript|data):[^\s>]*/gi, '$1""');
|
|
21001
21049
|
}
|
|
@@ -21090,6 +21138,34 @@ function editorTextScript(mode, selector) {
|
|
|
21090
21138
|
return el === null ? '' : String(el.innerText ?? el.textContent ?? '');
|
|
21091
21139
|
})()`;
|
|
21092
21140
|
}
|
|
21141
|
+
function draftConfirmClickScript(mode) {
|
|
21142
|
+
return `${rootScriptPrefix(mode)} // kk-shp-draft-confirm
|
|
21143
|
+
const mark = ${JSON.stringify(SHP_DRAFT_CONFIRM_DIALOG_TEXT)};
|
|
21144
|
+
const proceed = ${JSON.stringify(SHP_DRAFT_CONFIRM_PROCEED_LABEL)};
|
|
21145
|
+
for (const scope of [document, root]) {
|
|
21146
|
+
if (!scope) continue;
|
|
21147
|
+
// Anchor from the button side: the dialog text repeats across nested toast/dialog spans and
|
|
21148
|
+
// the last text-bearing element is a leaf without buttons (Grounded live probe 2026-11-11).
|
|
21149
|
+
for (const button of scope.querySelectorAll('button')) {
|
|
21150
|
+
if (String(button.textContent || '').trim() !== proceed || button.disabled) continue;
|
|
21151
|
+
// Only click a genuinely rendered dialog button: the vendor ships this dialog as a
|
|
21152
|
+
// permanently hidden 0\xD70 template inside the form (Grounded live probe 2026-11-11) \u2014
|
|
21153
|
+
// clicking the hidden copy is a silent no-op that would otherwise satisfy the rail.
|
|
21154
|
+
const rect = button.getBoundingClientRect();
|
|
21155
|
+
if (!(rect.width > 0 && rect.height > 0)) continue;
|
|
21156
|
+
let ancestor = button;
|
|
21157
|
+
for (let depth = 0; depth < 6 && ancestor; depth++) {
|
|
21158
|
+
if (String(ancestor.textContent || '').includes(mark)) {
|
|
21159
|
+
button.click();
|
|
21160
|
+
return JSON.stringify({ ok: true });
|
|
21161
|
+
}
|
|
21162
|
+
ancestor = ancestor.parentElement;
|
|
21163
|
+
}
|
|
21164
|
+
}
|
|
21165
|
+
}
|
|
21166
|
+
return JSON.stringify({ ok: false, reason: 'absent' });
|
|
21167
|
+
})()`;
|
|
21168
|
+
}
|
|
21093
21169
|
async function readReceiptUrls(page) {
|
|
21094
21170
|
const raw = await page.evaluate(`(() => { // kk-shp-receipt-urls
|
|
21095
21171
|
const patterns = [${SHP_RECEIPT_URL_RES.map((re) => re.toString()).join(", ")}];
|
|
@@ -21112,30 +21188,71 @@ async function readReceiptUrls(page) {
|
|
|
21112
21188
|
}
|
|
21113
21189
|
}
|
|
21114
21190
|
function receiptIdFrom(url) {
|
|
21115
|
-
return /\/(?:detail|video)\/([0-9a-zA-Z_-]+)/.exec(url)?.[1];
|
|
21191
|
+
return /\/(?:detail|video|audio|image|music)\/([0-9a-zA-Z_-]+)/.exec(url)?.[1];
|
|
21116
21192
|
}
|
|
21117
|
-
async function
|
|
21193
|
+
async function resolveMediaPath(raw, spec) {
|
|
21118
21194
|
if (typeof raw !== "string" || raw.trim().length === 0) {
|
|
21119
|
-
return {
|
|
21195
|
+
return {
|
|
21196
|
+
error: `metadata.${spec.field} must be a non-empty local ${spec.kindLabel} file path, got '${bounded(raw)}'`
|
|
21197
|
+
};
|
|
21120
21198
|
}
|
|
21121
21199
|
const path = raw.trim();
|
|
21122
|
-
if (
|
|
21200
|
+
if (!spec.extRe.test(path)) {
|
|
21123
21201
|
return {
|
|
21124
|
-
error: `metadata.
|
|
21202
|
+
error: `metadata.${spec.field} must be a local ${spec.extLabel} file, got unsupported extension in '${bounded(path)}'`
|
|
21125
21203
|
};
|
|
21126
21204
|
}
|
|
21127
21205
|
const file = Bun.file(path);
|
|
21128
21206
|
const readable = await file.exists().catch(() => false);
|
|
21129
21207
|
if (!readable || file.size === 0) {
|
|
21130
|
-
return {
|
|
21208
|
+
return {
|
|
21209
|
+
error: `metadata.${spec.field} does not resolve to a readable nonempty local ${spec.kindLabel} file`
|
|
21210
|
+
};
|
|
21131
21211
|
}
|
|
21132
21212
|
if (file.size > MAX_VIDEO_BYTES) {
|
|
21133
21213
|
return {
|
|
21134
|
-
error: `metadata.
|
|
21214
|
+
error: `metadata.${spec.field} exceeds the KK v1 local ${spec.kindLabel} cap of 2 GiB (${file.size} bytes; a local product bound, not a platform limit)`
|
|
21135
21215
|
};
|
|
21136
21216
|
}
|
|
21137
21217
|
return { path };
|
|
21138
21218
|
}
|
|
21219
|
+
function resolveVideoPath(raw) {
|
|
21220
|
+
return resolveMediaPath(raw, {
|
|
21221
|
+
field: "videoPath",
|
|
21222
|
+
kindLabel: "video",
|
|
21223
|
+
extLabel: "MP4/MOV",
|
|
21224
|
+
extRe: /\.(mp4|mov)$/i
|
|
21225
|
+
});
|
|
21226
|
+
}
|
|
21227
|
+
function resolveAudioPath(raw) {
|
|
21228
|
+
return resolveMediaPath(raw, {
|
|
21229
|
+
field: "audio (or audioFile)",
|
|
21230
|
+
kindLabel: "audio",
|
|
21231
|
+
extLabel: "MP3/M4A/WAV/AAC/FLAC",
|
|
21232
|
+
extRe: /\.(mp3|m4a|wav|aac|flac)$/i
|
|
21233
|
+
});
|
|
21234
|
+
}
|
|
21235
|
+
async function resolveImagesPath(raw) {
|
|
21236
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
21237
|
+
return {
|
|
21238
|
+
error: `metadata.images must be a non-empty array of local image file paths, got '${bounded(raw)}'`
|
|
21239
|
+
};
|
|
21240
|
+
}
|
|
21241
|
+
const paths = [];
|
|
21242
|
+
for (const entry of raw) {
|
|
21243
|
+
const candidate = typeof entry === "object" && entry !== null && "path" in entry ? entry.path : entry;
|
|
21244
|
+
const one = await resolveMediaPath(candidate, {
|
|
21245
|
+
field: "images[]",
|
|
21246
|
+
kindLabel: "image",
|
|
21247
|
+
extLabel: "PNG/JPEG/WebP",
|
|
21248
|
+
extRe: /\.(png|jpe?g|webp)$/i
|
|
21249
|
+
});
|
|
21250
|
+
if (one.error !== undefined)
|
|
21251
|
+
return { error: one.error };
|
|
21252
|
+
paths.push(one.path);
|
|
21253
|
+
}
|
|
21254
|
+
return { paths };
|
|
21255
|
+
}
|
|
21139
21256
|
async function resolveCoverPath(raw) {
|
|
21140
21257
|
if (raw === undefined)
|
|
21141
21258
|
return {};
|
|
@@ -21180,21 +21297,33 @@ function resolveOriginal(raw) {
|
|
|
21180
21297
|
}
|
|
21181
21298
|
return { original: raw };
|
|
21182
21299
|
}
|
|
21183
|
-
function unsupportedFields(payload) {
|
|
21300
|
+
function unsupportedFields(payload, operation) {
|
|
21301
|
+
const perOperation = {
|
|
21302
|
+
shortVideo: ["images", "categories", "publishTime", "scheduling"],
|
|
21303
|
+
audio: ["videoPath", "images", "categories", "publishTime", "scheduling"],
|
|
21304
|
+
music: ["videoPath", "images", "categories", "publishTime", "scheduling"],
|
|
21305
|
+
image: ["videoPath", "coverPath", "categories", "publishTime", "scheduling"]
|
|
21306
|
+
};
|
|
21184
21307
|
const refused = [];
|
|
21185
|
-
for (const [container,
|
|
21186
|
-
["options",
|
|
21187
|
-
["metadata",
|
|
21308
|
+
for (const [container, source] of [
|
|
21309
|
+
["options", payload.options],
|
|
21310
|
+
["metadata", payload.content.metadata]
|
|
21188
21311
|
]) {
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21312
|
+
if (source === undefined || source === null || typeof source !== "object")
|
|
21313
|
+
continue;
|
|
21314
|
+
for (const key of perOperation[operation]) {
|
|
21315
|
+
if (key in source)
|
|
21192
21316
|
refused.push(`${container}.${key}`);
|
|
21193
|
-
}
|
|
21194
21317
|
}
|
|
21195
21318
|
}
|
|
21196
21319
|
return refused;
|
|
21197
21320
|
}
|
|
21321
|
+
var POST_FLOW_SPECS = {
|
|
21322
|
+
shortVideo: { selectors: SHP_VIDEO_SELECTORS, fileSelectors: SHP_VIDEO_SELECTORS.videoInput, mediaLabel: "video" },
|
|
21323
|
+
audio: { selectors: SHP_AUDIO_SELECTORS, fileSelectors: SHP_AUDIO_SELECTORS.audioInput, mediaLabel: "audio" },
|
|
21324
|
+
music: { selectors: SHP_MUSIC_SELECTORS, fileSelectors: SHP_MUSIC_SELECTORS.audioInput, mediaLabel: "music" },
|
|
21325
|
+
image: { selectors: SHP_IMAGE_SELECTORS, fileSelectors: SHP_IMAGE_SELECTORS.imagesInput, mediaLabel: "image" }
|
|
21326
|
+
};
|
|
21198
21327
|
function editingFormReadyScript(mode, titleSelector, editorSelector) {
|
|
21199
21328
|
return `${rootScriptPrefix(mode)}
|
|
21200
21329
|
const title = root === null ? null : root.querySelector(${JSON.stringify(titleSelector)});
|
|
@@ -21355,32 +21484,53 @@ class ShipinhaoBrowserTransport {
|
|
|
21355
21484
|
if (requested !== undefined && requested !== "draft" && requested !== "public") {
|
|
21356
21485
|
return fail(SHP_TARGET, `unknown publishStatus '${bounded(requested)}' for ${SHP_TARGET}: expected 'draft', 'public' or absent (absent defaults to draft)`);
|
|
21357
21486
|
}
|
|
21358
|
-
if (payload.content.format !== "video") {
|
|
21487
|
+
if (this.operation === "shortVideo" && payload.content.format !== "video") {
|
|
21359
21488
|
return fail(SHP_TARGET, `shipinhao shortVideo requires Content.format 'video', got '${bounded(payload.content.format)}'`);
|
|
21360
21489
|
}
|
|
21361
21490
|
const title = payload.content.title?.trim() ?? "";
|
|
21362
21491
|
if (title.length === 0) {
|
|
21363
|
-
return fail(SHP_TARGET,
|
|
21492
|
+
return fail(SHP_TARGET, `shipinhao ${this.operation} requires a non-empty Content.title (the \u77ED\u6807\u9898 input, shipinhao.js:638-654)`);
|
|
21364
21493
|
}
|
|
21365
21494
|
const body = payload.content.body.trim();
|
|
21366
21495
|
if (body.length === 0) {
|
|
21367
|
-
return fail(SHP_TARGET,
|
|
21368
|
-
}
|
|
21369
|
-
const
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21496
|
+
return fail(SHP_TARGET, `shipinhao ${this.operation} requires non-empty Content.body Markdown (the \u6DFB\u52A0\u63CF\u8FF0 description is pasted as sanitized text/html, shipinhao.js:669-674)`);
|
|
21497
|
+
}
|
|
21498
|
+
const metadataRecord = payload.content.metadata ?? {};
|
|
21499
|
+
let media;
|
|
21500
|
+
let coverPath;
|
|
21501
|
+
if (this.operation === "shortVideo") {
|
|
21502
|
+
const video = await resolveVideoPath(metadataRecord.videoPath);
|
|
21503
|
+
if (video.error !== undefined)
|
|
21504
|
+
return fail(SHP_TARGET, video.error);
|
|
21505
|
+
media = [video.path];
|
|
21506
|
+
const cover = await resolveCoverPath(payload.content.metadata?.coverPath ?? payload.options?.coverPath);
|
|
21507
|
+
if (cover.error !== undefined)
|
|
21508
|
+
return fail(SHP_TARGET, cover.error);
|
|
21509
|
+
coverPath = cover.path;
|
|
21510
|
+
} else if (this.operation === "audio" || this.operation === "music") {
|
|
21511
|
+
const audio = await resolveAudioPath(metadataRecord.audio ?? metadataRecord.audioFile);
|
|
21512
|
+
if (audio.error !== undefined)
|
|
21513
|
+
return fail(SHP_TARGET, audio.error);
|
|
21514
|
+
media = [audio.path];
|
|
21515
|
+
const cover = await resolveCoverPath(payload.content.metadata?.coverPath ?? payload.options?.coverPath);
|
|
21516
|
+
if (cover.error !== undefined)
|
|
21517
|
+
return fail(SHP_TARGET, cover.error);
|
|
21518
|
+
coverPath = cover.path;
|
|
21519
|
+
} else {
|
|
21520
|
+
const images = await resolveImagesPath(metadataRecord.images);
|
|
21521
|
+
if (images.error !== undefined)
|
|
21522
|
+
return fail(SHP_TARGET, images.error);
|
|
21523
|
+
media = images.paths;
|
|
21524
|
+
}
|
|
21375
21525
|
const tags = resolveTags(payload.content.metadata?.tags ?? payload.options?.tags);
|
|
21376
21526
|
if (tags.error !== undefined)
|
|
21377
21527
|
return fail(SHP_TARGET, tags.error);
|
|
21378
21528
|
const original = resolveOriginal(payload.content.metadata?.original);
|
|
21379
21529
|
if (original.error !== undefined)
|
|
21380
21530
|
return fail(SHP_TARGET, original.error);
|
|
21381
|
-
const unsupported = unsupportedFields(payload);
|
|
21531
|
+
const unsupported = unsupportedFields(payload, this.operation);
|
|
21382
21532
|
if (unsupported.length > 0) {
|
|
21383
|
-
return fail(SHP_TARGET, `unsupported field(s) ${unsupported.join(", ")} for shipinhao
|
|
21533
|
+
return fail(SHP_TARGET, `unsupported field(s) ${unsupported.join(", ")} for shipinhao ${this.operation}: implemented fields are title/description/tags/media/cover/original declaration only, and scheduling/publishTime is an unported vendor enhancement (shipinhao.js:7-9)`);
|
|
21384
21534
|
}
|
|
21385
21535
|
const override = typeof payload.options?.profileDir === "string" ? payload.options.profileDir : undefined;
|
|
21386
21536
|
const profileDir = resolveChannelProfileDir(SHP_TARGET, override);
|
|
@@ -21396,18 +21546,18 @@ class ShipinhaoBrowserTransport {
|
|
|
21396
21546
|
try {
|
|
21397
21547
|
return await withProfilePage({
|
|
21398
21548
|
profileDir,
|
|
21399
|
-
url:
|
|
21549
|
+
url: SHP_HOME_URL_BY_OPERATION[this.operation],
|
|
21400
21550
|
isAuthenticated: isShipinhaoAuthenticated,
|
|
21401
21551
|
headless: payload.options?.headless === true,
|
|
21402
21552
|
launcher: this.launcher,
|
|
21403
21553
|
timeoutMs: this.stepTimeoutMs
|
|
21404
|
-
}, async ({ page }) => this.
|
|
21554
|
+
}, async ({ page }) => this.runPostFlow(page, POST_FLOW_SPECS[this.operation], title, body, tags.tags, original.original === true, media, coverPath, requested === "public", profileDir));
|
|
21405
21555
|
} catch (error) {
|
|
21406
21556
|
const detail = errorMessage3(error);
|
|
21407
21557
|
return fail(SHP_TARGET, needsLogin(error) ? `${SHP_TARGET} session failed \u2014 run: ${SHP_LOGIN_INSTRUCTION} \u2014 detail: ${detail}` : detail);
|
|
21408
21558
|
}
|
|
21409
21559
|
}
|
|
21410
|
-
async
|
|
21560
|
+
async runPostFlow(page, spec, title, body, tags, declareOriginal, media, coverPath, publishPublic, profileDir) {
|
|
21411
21561
|
const publishStatus = publishPublic ? "public" : "draft";
|
|
21412
21562
|
const metadata = {
|
|
21413
21563
|
operation: this.operation,
|
|
@@ -21416,36 +21566,56 @@ class ShipinhaoBrowserTransport {
|
|
|
21416
21566
|
profileDir,
|
|
21417
21567
|
...declareOriginal ? { original: true } : {}
|
|
21418
21568
|
};
|
|
21569
|
+
const entrySnapshot = await readRootSnapshot(page);
|
|
21570
|
+
if (entrySnapshot.shadowFileInputs + entrySnapshot.directFileInputs === 0) {
|
|
21571
|
+
const entryRoot = await resolveCreatorRoot(page);
|
|
21572
|
+
if (entryRoot.error !== undefined)
|
|
21573
|
+
return stageFail(SHP_TARGET, entryRoot.error, "root-resolve", metadata);
|
|
21574
|
+
try {
|
|
21575
|
+
const entry = (await resolveRootLocator(page, entryRoot.mode, spec.selectors.createEntry, "shipinhao create entry", this.stepTimeoutMs)).locator;
|
|
21576
|
+
await entry.click();
|
|
21577
|
+
} catch (error) {
|
|
21578
|
+
return stageFail(SHP_TARGET, `shipinhao create entry click failed \u2014 ${errorMessage3(error)}`, "entry-open", metadata);
|
|
21579
|
+
}
|
|
21580
|
+
const opened = await expectOutcome(async () => {
|
|
21581
|
+
const snapshot = await readRootSnapshot(page);
|
|
21582
|
+
return snapshot.shadowFileInputs + snapshot.directFileInputs > 0 ? "create surface open" : null;
|
|
21583
|
+
}, { timeoutMs: this.stepTimeoutMs, label: "shipinhao create surface" });
|
|
21584
|
+
if (!opened.ok)
|
|
21585
|
+
return stageFail(SHP_TARGET, `shipinhao create surface never opened after the entry click \u2014 no media file input appeared in the active root \u2014 ${opened.error}`, "entry-open", metadata);
|
|
21586
|
+
}
|
|
21419
21587
|
const root = await resolveCreatorRoot(page);
|
|
21420
21588
|
if (root.error !== undefined)
|
|
21421
21589
|
return stageFail(SHP_TARGET, root.error, "root-resolve", metadata);
|
|
21422
21590
|
const mode = root.mode;
|
|
21423
21591
|
try {
|
|
21424
|
-
const resolved = await resolveRootLocator(page, mode,
|
|
21592
|
+
const resolved = await resolveRootLocator(page, mode, spec.fileSelectors, `shipinhao ${spec.mediaLabel} file input`, this.stepTimeoutMs);
|
|
21425
21593
|
if (resolved.selector === 'input[type="file"]' && await resolved.locator.count() !== 1) {
|
|
21426
|
-
return stageFail(SHP_TARGET, `shipinhao
|
|
21594
|
+
return stageFail(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input ambiguous: the untyped input[type=file] candidate matched more than one input in the ${mode === "wujie" ? "wujie shadowRoot" : "document"} root \u2014 the vendor resolves a unique untyped input or nothing (shipinhao.js:580-583)`, "root-resolve", metadata);
|
|
21427
21595
|
}
|
|
21428
|
-
await resolved.locator.setInputFiles(
|
|
21596
|
+
await resolved.locator.setInputFiles(media.length === 1 ? media[0] : media, {
|
|
21597
|
+
timeout: this.stepTimeoutMs
|
|
21598
|
+
});
|
|
21429
21599
|
} catch (error) {
|
|
21430
|
-
return stageFail(SHP_TARGET, `shipinhao
|
|
21600
|
+
return stageFail(SHP_TARGET, `shipinhao ${spec.mediaLabel} file input/attach failed on ${page.url()}: ${errorMessage3(error)}`, "upload-timeout", metadata);
|
|
21431
21601
|
}
|
|
21432
21602
|
let titleSelector;
|
|
21433
21603
|
let editorSelector;
|
|
21434
21604
|
try {
|
|
21435
|
-
titleSelector = (await resolveRootLocator(page, mode,
|
|
21436
|
-
editorSelector = (await resolveRootLocator(page, mode,
|
|
21605
|
+
titleSelector = (await resolveRootLocator(page, mode, spec.selectors.titleInput, "shipinhao title input", this.stepTimeoutMs)).selector;
|
|
21606
|
+
editorSelector = (await resolveRootLocator(page, mode, spec.selectors.descriptionEditor, "shipinhao description editor", this.stepTimeoutMs)).selector;
|
|
21437
21607
|
} catch (error) {
|
|
21438
|
-
return stageFail(SHP_TARGET, `shipinhao media processing not confirmed: the file was assigned but the post-upload editing form never appeared \u2014 ${errorMessage3(error)}; refusing to claim an uploaded
|
|
21608
|
+
return stageFail(SHP_TARGET, `shipinhao media processing not confirmed: the file was assigned but the post-upload editing form never appeared \u2014 ${errorMessage3(error)}; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
|
|
21439
21609
|
}
|
|
21440
21610
|
const formReady = await expectOutcome(async () => {
|
|
21441
21611
|
const raw = String(await page.evaluate(editingFormReadyScript(mode, titleSelector, editorSelector)));
|
|
21442
21612
|
return JSON.parse(raw).ready === true ? "editing form observed in the active root" : null;
|
|
21443
21613
|
}, { timeoutMs: SHP_UPLOAD_TIMEOUT_MS, label: "shipinhao media processing" });
|
|
21444
21614
|
if (!formReady.ok) {
|
|
21445
|
-
return stageFail(SHP_TARGET, `shipinhao media processing not confirmed within the ${SHP_UPLOAD_TIMEOUT_MS}ms ceiling \u2014 the file was assigned but no editing form appeared; refusing to claim an uploaded
|
|
21615
|
+
return stageFail(SHP_TARGET, `shipinhao media processing not confirmed within the ${SHP_UPLOAD_TIMEOUT_MS}ms ceiling \u2014 the file was assigned but no editing form appeared; refusing to claim an uploaded ${spec.mediaLabel}`, "upload-processing", metadata);
|
|
21446
21616
|
}
|
|
21447
21617
|
try {
|
|
21448
|
-
const titleInput = (await resolveRootLocator(page, mode,
|
|
21618
|
+
const titleInput = (await resolveRootLocator(page, mode, spec.selectors.titleInput, "shipinhao title input", this.stepTimeoutMs)).locator;
|
|
21449
21619
|
await titleInput.fill(title);
|
|
21450
21620
|
const readback = await expectOutcome(async () => normalizeText(String(await page.evaluate(titleValueScript(mode, titleSelector)))) === normalizeText(title) ? "title read back" : null, { timeoutMs: this.stepTimeoutMs, label: "shipinhao title readback" });
|
|
21451
21621
|
if (!readback.ok)
|
|
@@ -21453,15 +21623,13 @@ class ShipinhaoBrowserTransport {
|
|
|
21453
21623
|
} catch (error) {
|
|
21454
21624
|
return stageFail(SHP_TARGET, `shipinhao title fill failed \u2014 ${errorMessage3(error)}`, "title-readback", metadata);
|
|
21455
21625
|
}
|
|
21456
|
-
const html =
|
|
21457
|
-
|
|
21458
|
-
${tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ")}`));
|
|
21626
|
+
const { description, html } = buildShipinhaoDescription(body, tags);
|
|
21459
21627
|
try {
|
|
21460
|
-
const editorSelector = (await resolveRootLocator(page, mode,
|
|
21628
|
+
const editorSelector = (await resolveRootLocator(page, mode, spec.selectors.descriptionEditor, "shipinhao description editor", this.stepTimeoutMs)).selector;
|
|
21461
21629
|
await pasteRichText(page, mode, editorSelector, html);
|
|
21462
21630
|
const readback = await expectOutcome(async () => {
|
|
21463
21631
|
const editorText = String(await page.evaluate(editorTextScript(mode, editorSelector)));
|
|
21464
|
-
return editorText.length > 0 && normalizeText(editorText).includes(normalizeText(
|
|
21632
|
+
return editorText.length > 0 && normalizeText(editorText).includes(normalizeText(description)) && tags.every((tag) => editorText.includes(`#${tag.replace(/^#/, "")}`)) ? "description and topics read back" : null;
|
|
21465
21633
|
}, { timeoutMs: this.stepTimeoutMs, label: "shipinhao description paste readback" });
|
|
21466
21634
|
if (!readback.ok)
|
|
21467
21635
|
return stageFail(SHP_TARGET, `shipinhao description readback failed \u2014 the editor did not retain the pasted description/topics \u2014 ${readback.error}`, "description-paste-readback", metadata);
|
|
@@ -21479,7 +21647,7 @@ ${tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ")}`));
|
|
|
21479
21647
|
return coverOutcome;
|
|
21480
21648
|
}
|
|
21481
21649
|
const stage = publishPublic ? "publish-click" : "draft-save";
|
|
21482
|
-
const submitSelectors = publishPublic ?
|
|
21650
|
+
const submitSelectors = publishPublic ? spec.selectors.publishButton : spec.selectors.saveButton;
|
|
21483
21651
|
let submitLocator;
|
|
21484
21652
|
try {
|
|
21485
21653
|
const resolved = await resolveRootLocator(page, mode, submitSelectors, "shipinhao submit control", this.stepTimeoutMs);
|
|
@@ -21501,6 +21669,12 @@ ${tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ")}`));
|
|
|
21501
21669
|
const beforeReceipts = new Set(await readReceiptUrls(page));
|
|
21502
21670
|
await submitLocator.click();
|
|
21503
21671
|
const confirmed = await expectOutcome(async () => {
|
|
21672
|
+
if (!publishPublic) {
|
|
21673
|
+
const confirmRaw = String(await page.evaluate(draftConfirmClickScript(mode)));
|
|
21674
|
+
const confirm = JSON.parse(confirmRaw);
|
|
21675
|
+
if (confirm.ok)
|
|
21676
|
+
return null;
|
|
21677
|
+
}
|
|
21504
21678
|
const fresh = (await readReceiptUrls(page)).filter((candidate) => !beforeReceipts.has(candidate));
|
|
21505
21679
|
if (fresh.length === 0)
|
|
21506
21680
|
return null;
|
|
@@ -21534,7 +21708,7 @@ ${tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ")}`));
|
|
|
21534
21708
|
target: SHP_TARGET,
|
|
21535
21709
|
id: receiptIdFrom(url),
|
|
21536
21710
|
url,
|
|
21537
|
-
message: `shipinhao
|
|
21711
|
+
message: `shipinhao ${this.operation} ${publishStatus} confirmed in profile ${profileDir}`,
|
|
21538
21712
|
metadata: { ...metadata, confirmedBy: receiptStage }
|
|
21539
21713
|
});
|
|
21540
21714
|
}
|
|
@@ -21627,7 +21801,7 @@ ${tags.map((tag) => `#${tag.replace(/^#/, "")}`).join(" ")}`));
|
|
|
21627
21801
|
}
|
|
21628
21802
|
|
|
21629
21803
|
// ../../plugins/publishings/shipinhao-pub/src/index.ts
|
|
21630
|
-
var SHP_OPERATIONS =
|
|
21804
|
+
var SHP_OPERATIONS = SHP_OPERATION_NAMES;
|
|
21631
21805
|
function resolveOperation(options, content) {
|
|
21632
21806
|
const raw = options?.operation ?? content?.metadata?.operation ?? "shortVideo";
|
|
21633
21807
|
if (typeof raw !== "string" || !SHP_OPERATIONS.includes(raw)) {
|
|
@@ -20097,10 +20097,12 @@ function normalizeSessionIdentity(value) {
|
|
|
20097
20097
|
}
|
|
20098
20098
|
class BotError extends Error {
|
|
20099
20099
|
code;
|
|
20100
|
-
|
|
20100
|
+
details;
|
|
20101
|
+
constructor(code, message, details = {}) {
|
|
20101
20102
|
super(message);
|
|
20102
20103
|
this.name = "BotError";
|
|
20103
20104
|
this.code = code;
|
|
20105
|
+
this.details = details;
|
|
20104
20106
|
}
|
|
20105
20107
|
}
|
|
20106
20108
|
// ../../packages/publish-harness/src/index.ts
|
|
@@ -20424,7 +20426,8 @@ function errorMessage2(error) {
|
|
|
20424
20426
|
|
|
20425
20427
|
// ../../plugins/publishings/shipinhao-pub/src/selectors.ts
|
|
20426
20428
|
var SHP_TARGET = "shipinhao";
|
|
20427
|
-
var SHP_HOME_URL = "https://channels.weixin.qq.com/platform
|
|
20429
|
+
var SHP_HOME_URL = "https://channels.weixin.qq.com/platform";
|
|
20430
|
+
var SHP_CREATE_ENTRY_SELECTORS = ['button:text-is("\u53D1\u8868\u89C6\u9891")'];
|
|
20428
20431
|
var SHP_LOGIN_URL_RE = /(open\.weixin\.qq\.com|channels\.weixin\.qq\.com\/platform\/(login|scan))/;
|
|
20429
20432
|
var ROOT_SNAPSHOT_SCRIPT = `(() => { // kk-shp-root-snapshot
|
|
20430
20433
|
const wujieApp = document.querySelector('wujie-app');
|
|
@@ -20458,6 +20461,52 @@ async function readRootSnapshot(page) {
|
|
|
20458
20461
|
shadowTextEvidence: 0
|
|
20459
20462
|
};
|
|
20460
20463
|
}
|
|
20464
|
+
var SHP_VIDEO_SELECTORS = {
|
|
20465
|
+
createEntry: SHP_CREATE_ENTRY_SELECTORS,
|
|
20466
|
+
videoInput: [
|
|
20467
|
+
'input[type="file"][accept*="video"]',
|
|
20468
|
+
'input[type="file"][accept*=".mp4"]',
|
|
20469
|
+
'input[type="file"][accept*=".mov"]',
|
|
20470
|
+
'section:has(input[type="file"]):has-text("\u4E0A\u4F20\u89C6\u9891") input[type="file"]',
|
|
20471
|
+
'section:has(input[type="file"]):has-text("\u89C6\u9891\u6587\u4EF6") input[type="file"]',
|
|
20472
|
+
'input[type="file"]'
|
|
20473
|
+
],
|
|
20474
|
+
titleInput: ['input[placeholder*="\u77ED\u6807\u9898"]', 'input[placeholder*="\u586B\u5199\u6807\u9898"]', 'input[placeholder*="\u6807\u9898"]'],
|
|
20475
|
+
descriptionEditor: [
|
|
20476
|
+
'[data-placeholder^="\u6DFB\u52A0\u63CF\u8FF0"]',
|
|
20477
|
+
'[placeholder^="\u6DFB\u52A0\u63CF\u8FF0"]',
|
|
20478
|
+
'[role="textbox"][aria-label^="\u6DFB\u52A0\u63CF\u8FF0"]',
|
|
20479
|
+
'[placeholder*="\u8BDD\u9898\u548C\u63CF\u8FF0"]'
|
|
20480
|
+
],
|
|
20481
|
+
coverEditEntry: ["div.cover-preview-wrap > div"],
|
|
20482
|
+
coverDialog: [
|
|
20483
|
+
"div.cover-control-wrap",
|
|
20484
|
+
'div[class*="cover"][class*="dialog"]',
|
|
20485
|
+
'div[class*="cover"][class*="modal"]',
|
|
20486
|
+
'[role="dialog"]'
|
|
20487
|
+
],
|
|
20488
|
+
coverDialogFileInputSuffix: 'input[type="file"]',
|
|
20489
|
+
coverConfirmLabels: ["\u786E\u8BA4", "\u5B8C\u6210", "\u4FDD\u5B58", "\u5E94\u7528", "\u786E\u5B9A"],
|
|
20490
|
+
coverConfirmFooter: "div.finder-dialog-footer button",
|
|
20491
|
+
originalAgreementCheckbox: 'div.declare-body-wrapper input[type="checkbox"].ant-checkbox-input',
|
|
20492
|
+
originalConfirmLabel: "\u58F0\u660E\u539F\u521B",
|
|
20493
|
+
saveButton: ['button:text-is("\u4FDD\u5B58\u8349\u7A3F")'],
|
|
20494
|
+
publishButton: ['button:text-is("\u53D1\u8868")', '[role="button"]:text-is("\u53D1\u8868")']
|
|
20495
|
+
};
|
|
20496
|
+
var SHP_AUDIO_SELECTORS = {
|
|
20497
|
+
...SHP_VIDEO_SELECTORS,
|
|
20498
|
+
audioInput: ['input[type="file"][accept*="video"]', 'input[type="file"]']
|
|
20499
|
+
};
|
|
20500
|
+
var SHP_MUSIC_SELECTORS = { ...SHP_AUDIO_SELECTORS };
|
|
20501
|
+
var SHP_IMAGE_SELECTORS = {
|
|
20502
|
+
...SHP_VIDEO_SELECTORS,
|
|
20503
|
+
imagesInput: [
|
|
20504
|
+
'input[type="file"][multiple]',
|
|
20505
|
+
'input[type="file"][accept*="image"]',
|
|
20506
|
+
'section:has(input[type="file"]):has-text("\u4E0A\u4F20\u56FE\u7247") input[type="file"]',
|
|
20507
|
+
'input[type="file"]'
|
|
20508
|
+
]
|
|
20509
|
+
};
|
|
20461
20510
|
var SHP_LOGIN_TIMEOUT_MS = 180000;
|
|
20462
20511
|
var isShipinhaoAuthenticated = async (page) => {
|
|
20463
20512
|
if (SHP_LOGIN_URL_RE.test(page.url()))
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"entry": "./dist/index.js",
|
|
5
5
|
"check": "./dist/profile-check.js",
|
|
6
6
|
"version": "1.0.0",
|
|
7
|
-
"description": "shipinhao (channels.weixin.qq.com)
|
|
7
|
+
"description": "shipinhao (channels.weixin.qq.com) publish via a script browser transport with wujie-app shadowRoot traversal; four post kinds (shortVideo 视频, audio 音频, image 图文, music 音乐 — audio is the first deliverable); draft by default, public only on an explicit publishStatus with a fresh works receipt, requested-only 声明原创 declaration",
|
|
8
8
|
"browserSession": {
|
|
9
9
|
"profileName": "shipinhao",
|
|
10
|
-
"homeUrl": "https://channels.weixin.qq.com/platform
|
|
10
|
+
"homeUrl": "https://channels.weixin.qq.com/platform"
|
|
11
11
|
}
|
|
12
12
|
}
|