channel-worker 2.5.19 → 2.5.20
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/package.json +1 -1
- package/scripts/upload_facebook.js +18 -18
package/package.json
CHANGED
|
@@ -283,7 +283,7 @@ async function run({ page, payload, log }) {
|
|
|
283
283
|
} = payload || {};
|
|
284
284
|
if (!video_url) throw new Error('No video_url provided');
|
|
285
285
|
|
|
286
|
-
log('info', '[fb-pw] selectors version=2026.06.
|
|
286
|
+
log('info', '[fb-pw] selectors version=2026.06.19a-thumb-advance');
|
|
287
287
|
|
|
288
288
|
page.on('dialog', (d) => { d.accept().catch(() => {}); });
|
|
289
289
|
|
|
@@ -948,7 +948,6 @@ async function run({ page, payload, log }) {
|
|
|
948
948
|
// iterations, throw with diagnostics.
|
|
949
949
|
let published = false;
|
|
950
950
|
let customThumbDone = false;
|
|
951
|
-
let thumbWaitDone = false; // poll for the thumb-edit pill at most once
|
|
952
951
|
let pubWaitDone = false; // guard: wait for a disabled "Đăng" at most once
|
|
953
952
|
for (let step = 0; step < 7 && !published; step++) {
|
|
954
953
|
await page.waitForTimeout(3000);
|
|
@@ -1001,17 +1000,18 @@ async function run({ page, payload, log }) {
|
|
|
1001
1000
|
return null;
|
|
1002
1001
|
}).catch(() => null);
|
|
1003
1002
|
let editBtn = await findThumbBtn();
|
|
1004
|
-
// The "Chỉnh sửa hình thu nhỏ" pill
|
|
1005
|
-
//
|
|
1006
|
-
//
|
|
1007
|
-
//
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1003
|
+
// The "Chỉnh sửa hình thu nhỏ" pill appears AFTER FB finishes processing
|
|
1004
|
+
// the video AND, on the Page-wall composer, only on a LATER step (the
|
|
1005
|
+
// cover/caption step AFTER clicking "Tiếp" from the video step) — NOT on
|
|
1006
|
+
// the first video step. So poll briefly on THIS step; if it never shows,
|
|
1007
|
+
// fall through to click "Tiếp" and look again on the next step. Per-step
|
|
1008
|
+
// (not one-time) so the pill is caught on whichever step it renders.
|
|
1009
|
+
if (!editBtn) {
|
|
1010
|
+
log('info', '[fb-pw] thumb-edit pill not visible on this step — polling up to 18s…');
|
|
1011
|
+
const tdl = Date.now() + 18_000;
|
|
1012
|
+
while (!editBtn && Date.now() < tdl) { await page.waitForTimeout(3000); editBtn = await findThumbBtn(); }
|
|
1012
1013
|
if (editBtn) log('info', '[fb-pw] thumb-edit pill appeared after wait');
|
|
1013
1014
|
}
|
|
1014
|
-
thumbWaitDone = true;
|
|
1015
1015
|
|
|
1016
1016
|
let thumbApplied = false;
|
|
1017
1017
|
if (editBtn) {
|
|
@@ -1158,14 +1158,14 @@ async function run({ page, payload, log }) {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
customThumbDone = thumbApplied;
|
|
1160
1160
|
}
|
|
1161
|
-
//
|
|
1162
|
-
//
|
|
1163
|
-
//
|
|
1164
|
-
//
|
|
1161
|
+
// Pill not on THIS step (e.g. the video step before "Tiếp", or the
|
|
1162
|
+
// cover step hasn't rendered yet). Do NOT hard-fail here — click "Tiếp"
|
|
1163
|
+
// to advance and retry the thumb flow on the next step. The pre-publish
|
|
1164
|
+
// check below (before clicking "Đăng") hard-fails if the thumb was never
|
|
1165
|
+
// applied across ANY step, so nothing ships with FB's auto-thumb and a
|
|
1166
|
+
// retry can't double-post.
|
|
1165
1167
|
if (!customThumbDone) {
|
|
1166
|
-
|
|
1167
|
-
await dumpFailure(page, 'thumb-required-missing', log);
|
|
1168
|
-
throw new Error('Custom thumbnail required but could not be applied (FB "Chỉnh sửa hình thu nhỏ" not available, or upload/save failed) — refusing to publish with FB auto-thumb');
|
|
1168
|
+
log('info', '[fb-pw] thumb-edit pill not on this step yet — advancing via "Tiếp" to retry on the next step');
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
1171
|
|