channel-worker 2.5.62 → 2.5.63

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.62",
3
+ "version": "2.5.63",
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": {
@@ -22,12 +22,22 @@ const path = require('path');
22
22
  const { downloadToTemp, safeUnlink } = require('./lib/download');
23
23
 
24
24
  const FB_HOME_URL = 'https://www.facebook.com/';
25
+ const FB_REEL_CREATE_URL = 'https://www.facebook.com/reels/create/';
25
26
  const REEL_CREATE_SELECTORS = [
26
27
  "a[aria-label='Tạo thước phim']",
27
28
  "a[aria-label='Create reel']",
28
29
  "a[aria-label='Create a reel']",
29
30
  "a[href*='/reels/create']",
30
31
  ];
32
+ const REEL_ENTRY_SELECTORS = [
33
+ "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Thước phim']",
34
+ "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Reel']",
35
+ "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Reels']",
36
+ "div[role='region'][aria-label='Create post'] [aria-label='Reel']",
37
+ "div[role='region'][aria-label='Create post'] [aria-label='Reels']",
38
+ "div[role='region'][aria-label='Create post'] [aria-label='Create reel']",
39
+ "div[role='region'][aria-label='Create post'] [aria-label='Create a reel']",
40
+ ];
31
41
  // Residential proxies can leave Facebook's final "Đang tải..." state active
32
42
  // well past three minutes. The API only declares a publish command stale after
33
43
  // 20 minutes, so give the real upload enough room instead of failing while FB
@@ -91,6 +101,18 @@ async function navigateFacebookHome(page, log) {
91
101
  throw lastError || new Error('FB home navigation failed');
92
102
  }
93
103
 
104
+ // Some Facebook cohorts render the Page-wall create-post widget as icon-only
105
+ // controls (no Reel text/aria-label). In that layout there is no safe DOM
106
+ // selector that distinguishes the composer trigger from the sidebar Reels feed.
107
+ // Navigate to Facebook's dedicated CREATE route instead. This is only called
108
+ // before a file is selected, so repeating it cannot create a duplicate post.
109
+ async function navigateFacebookReelCreate(page, log) {
110
+ log('warn', '[fb-pw] Reel entry unavailable — hard navigating to /reels/create/ before upload…');
111
+ await page.goto(FB_REEL_CREATE_URL, { waitUntil: 'commit', timeout: 60_000 });
112
+ await page.waitForLoadState('domcontentloaded', { timeout: 60_000 }).catch(() => {});
113
+ await pause(page, 7000);
114
+ }
115
+
94
116
  // FB drops a "Thông báo mới" toast at the BOTTOM-LEFT of the wall (e.g. "… và
95
117
  // 96 người khác thích thước phim của bạn") that lands ON TOP of the Reels
96
118
  // composer's bottom CTA. Playwright's hit-target check then blocks every
@@ -513,7 +535,7 @@ async function runOnce({ page, payload, log }) {
513
535
  } = payload || {};
514
536
  if (!video_url) throw new Error('No video_url provided');
515
537
 
516
- log('info', '[fb-pw] selectors version=2026.08.06-composer-retry-metadata-poll');
538
+ log('info', '[fb-pw] selectors version=2026.08.28-icon-only-create-route-fallback');
517
539
 
518
540
  page.on('dialog', (d) => { d.accept().catch(() => {}); });
519
541
 
@@ -625,15 +647,8 @@ async function runOnce({ page, payload, log }) {
625
647
  // instead of opening the composer (observed on the brain-made-simple
626
648
  // page wall — clicked feed link, played random viral reel).
627
649
  log('info', '[fb-pw] click "Thước phim" entry inside "Tạo bài viết"…');
628
- const reelEntryCandidates = [
629
- // Scoped to the create-post widget — this is the only correct trigger.
630
- "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Thước phim']",
631
- "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Reel']",
632
- "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Reels']",
633
- "div[role='region'][aria-label='Create post'] [aria-label='Reels']",
634
- ];
635
650
  let reelOpened = false;
636
- for (const sel of reelEntryCandidates) {
651
+ for (const sel of REEL_ENTRY_SELECTORS) {
637
652
  const btn = await firstVisible(page.locator(sel), 5);
638
653
  if (!btn) continue;
639
654
  try {
@@ -677,9 +692,10 @@ async function runOnce({ page, payload, log }) {
677
692
  }
678
693
  }
679
694
  if (!reelOpened) {
680
- await dumpInventory(page, log, 'no-reel-entry');
681
- await dumpFailure(page, 'no-reel-entry', log);
682
- throw new Error('FB home: "Thước phim" entry not found in "Tạo bài viết" widget (sidebar Reels feed link doesn\'t count — it navigates instead of opening composer)');
695
+ // English/icon-only Page layouts expose Live video, Photo/video and Reel
696
+ // as bare SVG controls. The old code failed here even though the official
697
+ // create route was usable. Go there before touching any file input.
698
+ await navigateFacebookReelCreate(page, log);
683
699
  }
684
700
  await pause(page, 4000);
685
701
  const afterUrl = page.url();
@@ -748,10 +764,7 @@ async function runOnce({ page, payload, log }) {
748
764
  // stuck client-side router. No video has been selected yet, so this
749
765
  // cannot create a duplicate post.
750
766
  if (!reelsRoot) {
751
- log('warn', '[fb-pw] create link still produced no composer — hard navigating to /reels/create/…');
752
- await page.goto('https://www.facebook.com/reels/create/', { waitUntil: 'commit', timeout: 60_000 });
753
- await page.waitForLoadState('domcontentloaded', { timeout: 60_000 }).catch(() => {});
754
- await pause(page, 7000);
767
+ await navigateFacebookReelCreate(page, log);
755
768
  await dismissBsOnboarding(page, log).catch(() => {});
756
769
  reelsRoot = await findComposerRoot(8000);
757
770
  }
@@ -2721,6 +2734,9 @@ module.exports.__testables = {
2721
2734
  hasVisibleReelComposer,
2722
2735
  SAFE_RETRY_COMPOSER_CLOSED,
2723
2736
  navigateFacebookHome,
2737
+ navigateFacebookReelCreate,
2724
2738
  PUBLISH_ENABLE_TIMEOUT_MS,
2725
2739
  REEL_CREATE_SELECTORS,
2740
+ REEL_ENTRY_SELECTORS,
2741
+ FB_REEL_CREATE_URL,
2726
2742
  };