oc-browser-relay 1.0.13 → 1.0.15
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/bundled-relay/index.js +17 -0
- package/bundled-relay/public/configs/pages/taobao-item-detail.json +1 -55
- package/bundled-relay/public/configs/pages/xiaohongshu-creator-publish.json +5 -4
- package/bundled-relay/public/configs/sites/xiaohongshu-creator.json +6 -5
- package/bundled-relay/public/configs/task-templates/taobao-item-detail-comments.json +5 -5
- package/index.js +15 -15
- package/package.json +1 -1
- package/skills/oc-browser-relay-douyin-fxg/SKILL.md +7 -3
- package/skills/oc-browser-relay-pinduoduo/SKILL.md +3 -0
- package/skills/oc-browser-relay-sycm/SKILL.md +35 -13
- package/skills/oc-browser-relay-xiaohongshu/SKILL.md +2 -2
package/bundled-relay/index.js
CHANGED
|
@@ -23005,6 +23005,9 @@ function buildEffectiveDailyPeriod(now = /* @__PURE__ */ new Date()) {
|
|
|
23005
23005
|
function normalizeMetricPeriodLabel(value) {
|
|
23006
23006
|
return typeof value === "string" ? value.replace(/\s+/g, "") : "";
|
|
23007
23007
|
}
|
|
23008
|
+
function truncateByCharacters(value, maxLength) {
|
|
23009
|
+
return Array.from(value).slice(0, maxLength).join("");
|
|
23010
|
+
}
|
|
23008
23011
|
var TemplateExecutor = class _TemplateExecutor {
|
|
23009
23012
|
static isPublishItemTemplate(template) {
|
|
23010
23013
|
return template.platform === "xiaohongshu" && ["publish_note", "save_note_draft"].includes(template.taskType);
|
|
@@ -23190,9 +23193,23 @@ ${topicLine}`;
|
|
|
23190
23193
|
content: mergedContent
|
|
23191
23194
|
};
|
|
23192
23195
|
}
|
|
23196
|
+
normalizeXiaohongshuPublishData(template, data) {
|
|
23197
|
+
if (template.platform !== "xiaohongshu" || !["publish_note", "save_note_draft"].includes(template.taskType)) {
|
|
23198
|
+
return data;
|
|
23199
|
+
}
|
|
23200
|
+
const nextData = { ...data };
|
|
23201
|
+
if (typeof nextData.title === "string") {
|
|
23202
|
+
nextData.title = truncateByCharacters(nextData.title, 20);
|
|
23203
|
+
}
|
|
23204
|
+
if (Array.isArray(nextData.topics)) {
|
|
23205
|
+
nextData.topics = nextData.topics.map((topic) => typeof topic === "string" ? topic.trim() : "").filter(Boolean).slice(0, 10);
|
|
23206
|
+
}
|
|
23207
|
+
return nextData;
|
|
23208
|
+
}
|
|
23193
23209
|
async execute(template, data) {
|
|
23194
23210
|
let resolvedData = this.applyDefaults(template, data);
|
|
23195
23211
|
this.coerceArrayFields(template, resolvedData);
|
|
23212
|
+
resolvedData = this.normalizeXiaohongshuPublishData(template, resolvedData);
|
|
23196
23213
|
resolvedData = this.mergeXiaohongshuTopicsIntoContent(template, resolvedData);
|
|
23197
23214
|
this.validateRequiredFields(template, resolvedData);
|
|
23198
23215
|
this.validateRules(template, resolvedData);
|
|
@@ -172,61 +172,7 @@
|
|
|
172
172
|
"sourceId": "product_detail",
|
|
173
173
|
"timeoutMs": 12000,
|
|
174
174
|
"outputSchema": {
|
|
175
|
-
"root":
|
|
176
|
-
"itemId": "sources.product_detail.itemId",
|
|
177
|
-
"skuId": "sources.product_detail.skuId",
|
|
178
|
-
"spuId": {
|
|
179
|
-
"path": "sources.product_detail.spuId",
|
|
180
|
-
"transform": "trim_non_empty"
|
|
181
|
-
},
|
|
182
|
-
"title": {
|
|
183
|
-
"paths": [
|
|
184
|
-
"sources.product_detail.title"
|
|
185
|
-
],
|
|
186
|
-
"transform": "trim_non_empty"
|
|
187
|
-
},
|
|
188
|
-
"sellCount": {
|
|
189
|
-
"path": "sources.product_detail.sellCount",
|
|
190
|
-
"transform": "trim_non_empty"
|
|
191
|
-
},
|
|
192
|
-
"images": {
|
|
193
|
-
"from": "sources.product_detail.images",
|
|
194
|
-
"item": {
|
|
195
|
-
"urlDefault": "current"
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
"videoUrl": {
|
|
199
|
-
"path": "sources.product_detail.videoUrl",
|
|
200
|
-
"transform": "trim_non_empty"
|
|
201
|
-
},
|
|
202
|
-
"price": {
|
|
203
|
-
"original": {
|
|
204
|
-
"path": "sources.product_detail.priceOriginal",
|
|
205
|
-
"transform": "trim_non_empty"
|
|
206
|
-
},
|
|
207
|
-
"afterCoupon": {
|
|
208
|
-
"path": "sources.product_detail.priceAfterCoupon",
|
|
209
|
-
"transform": "trim_non_empty"
|
|
210
|
-
},
|
|
211
|
-
"money": {
|
|
212
|
-
"path": "sources.product_detail.priceMoney",
|
|
213
|
-
"transform": "trim_non_empty"
|
|
214
|
-
},
|
|
215
|
-
"moneyAfterCoupon": {
|
|
216
|
-
"path": "sources.product_detail.priceMoneyAfterCoupon",
|
|
217
|
-
"transform": "trim_non_empty"
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
"activityEndTime": {
|
|
221
|
-
"path": "sources.product_detail.activityEndTime",
|
|
222
|
-
"transform": "trim_non_empty"
|
|
223
|
-
},
|
|
224
|
-
"skuProps": "sources.product_detail.skuProps",
|
|
225
|
-
"skus": "sources.product_detail.skus",
|
|
226
|
-
"shop": "sources.product_detail.shop",
|
|
227
|
-
"attrs": "sources.product_detail.attrs",
|
|
228
|
-
"crawledAt": "sources.product_detail.crawledAt"
|
|
229
|
-
}
|
|
175
|
+
"root": "sources.product_detail"
|
|
230
176
|
}
|
|
231
177
|
},
|
|
232
178
|
"product_comments": {
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"visibleLocators": [
|
|
45
45
|
{
|
|
46
46
|
"kind": "css",
|
|
47
|
-
"value": ".
|
|
47
|
+
"value": ".image-upload-buttons .upload-button.bg-red",
|
|
48
48
|
"priority": 1
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"kind": "css",
|
|
52
|
-
"value": ".
|
|
52
|
+
"value": "button.upload-button.bg-red",
|
|
53
53
|
"priority": 2
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
"kind": "
|
|
57
|
-
"value": "
|
|
56
|
+
"kind": "css",
|
|
57
|
+
"value": ".image-upload-buttons button.upload-button",
|
|
58
58
|
"priority": 3
|
|
59
59
|
}
|
|
60
60
|
]
|
|
@@ -223,6 +223,7 @@
|
|
|
223
223
|
".edit-container input[type='text'][placeholder*='填写标题']",
|
|
224
224
|
"input[type='text'][placeholder*='填写标题']"
|
|
225
225
|
],
|
|
226
|
+
"successSettleDelayMs": 3000,
|
|
226
227
|
"countSelectors": [
|
|
227
228
|
".img-preview-area .img-container",
|
|
228
229
|
".img-preview-area .pr[data-draggable='true']",
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
{ "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]", "priority": 2 }
|
|
34
34
|
],
|
|
35
35
|
"menuItemLocators": [
|
|
36
|
-
{ "kind": "xpath", "value": "//div[contains(@class,'
|
|
37
|
-
{ "kind": "
|
|
36
|
+
{ "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]//div[contains(@class,'container')][./span[normalize-space()='上传图文']]", "priority": 1 },
|
|
37
|
+
{ "kind": "xpath", "value": "//div[contains(@class,'publish-video-popover')]//div[contains(@class,'container')][.//span[normalize-space()='上传图文']]", "priority": 2 }
|
|
38
38
|
],
|
|
39
|
-
"hoverDelayMs":
|
|
40
|
-
"menuWaitTimeoutMs":
|
|
41
|
-
"settleDelayMs":
|
|
39
|
+
"hoverDelayMs": 3000,
|
|
40
|
+
"menuWaitTimeoutMs": 3000,
|
|
41
|
+
"settleDelayMs": 3000,
|
|
42
|
+
"maxAttempts": 3,
|
|
42
43
|
"readyTimeoutMs": 8000
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"capturePlanId": "product_comments"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"when": "
|
|
80
|
+
"when": "gt(payload.targetCommentCount, 0)"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"nodeId": "s5",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"storeAs": "commentsData",
|
|
95
95
|
"outputs": ["commentsData"],
|
|
96
|
-
"when": "
|
|
96
|
+
"when": "gt(payload.targetCommentCount, 0)"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"nodeId": "s6",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"args": {
|
|
104
104
|
"action": "close_comments"
|
|
105
105
|
},
|
|
106
|
-
"when": "
|
|
106
|
+
"when": "gt(payload.targetCommentCount, 0)"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"nodeId": "s7",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"args": {
|
|
114
114
|
"action": "open_ask_answers"
|
|
115
115
|
},
|
|
116
|
-
"when": "
|
|
116
|
+
"when": "and(payload.includeAskAnswers, gt(payload.targetAskAnswerCount, 0))"
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"nodeId": "s8",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
},
|
|
130
130
|
"storeAs": "askAnswersData",
|
|
131
131
|
"outputs": ["askAnswersData"],
|
|
132
|
-
"when": "
|
|
132
|
+
"when": "and(payload.includeAskAnswers, gt(payload.targetAskAnswerCount, 0))"
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"nodeId": "s9",
|