channel-worker 2.5.22 → 2.5.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.5.22",
3
+ "version": "2.5.23",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {
@@ -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.19c-posturl-network-first');
286
+ log('info', '[fb-pw] selectors version=2026.06.19d-reels-link-fallback');
287
287
 
288
288
  page.on('dialog', (d) => { d.accept().catch(() => {}); });
289
289
 
@@ -454,9 +454,31 @@ async function run({ page, payload, log }) {
454
454
  .filter({ has: page.locator(":scope :text-matches('^Tạo thước phim$|^Create reel$|^Create a reel$', 'i')") })
455
455
  .first();
456
456
  if (!(await reelsDialog.isVisible({ timeout: 6000 }).catch(() => false))) {
457
- await dumpInventory(page, log, 'no-reels-modal');
458
- await dumpFailure(page, 'no-reels-modal', log);
459
- throw new Error('FB Reels modal "Tạo thước phim" did not open after clicking Thước phim entry');
457
+ // FALLBACK: some accounts render a different UI from the create-post
458
+ // "Thước phim" entry → the composer modal never mounts. Click the Reels
459
+ // link (any <a href*='/reels'>) instead, then re-wait for the modal.
460
+ log('warn', '[fb-pw] Reels modal not open — fallback: click <a href*="/reels"> then re-wait…');
461
+ let xpClicked = false;
462
+ try {
463
+ const reelsLink = page.locator("xpath=//a[contains(@href, '/reels')]").first();
464
+ if (await reelsLink.isVisible({ timeout: 3000 }).catch(() => false)) {
465
+ await reelsLink.click({ timeout: 4000 });
466
+ xpClicked = true;
467
+ log('info', '[fb-pw] clicked Reels link via xpath //a[contains(@href,"/reels")]');
468
+ } else {
469
+ log('warn', '[fb-pw] fallback: no visible <a href*="/reels"> found');
470
+ }
471
+ } catch (e) { log('warn', `[fb-pw] fallback Reels-link click failed: ${e.message.slice(0, 80)}`); }
472
+ if (xpClicked) {
473
+ await page.waitForTimeout(5000);
474
+ await dismissBsOnboarding(page, log).catch(() => {});
475
+ }
476
+ if (!(await reelsDialog.isVisible({ timeout: 8000 }).catch(() => false))) {
477
+ await dumpInventory(page, log, 'no-reels-modal');
478
+ await dumpFailure(page, 'no-reels-modal', log);
479
+ throw new Error('FB Reels modal "Tạo thước phim" did not open (kể cả sau fallback xpath //a[href*="/reels"])');
480
+ }
481
+ log('info', '[fb-pw] Reels modal opened after xpath /reels fallback');
460
482
  }
461
483
  // Candidates inside the modal only:
462
484
  // - "Tải lên" — the explicit blue upload button at the bottom (preferred)