channel-worker 2.5.66 → 2.5.68

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.66",
3
+ "version": "2.5.68",
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": {
@@ -29,6 +29,31 @@ const REEL_CREATE_SELECTORS = [
29
29
  "a[aria-label='Create a reel']",
30
30
  "a[href*='/reels/create']",
31
31
  ];
32
+ // Nút mở hộp chọn file BÊN TRONG hộp thoại "Tạo thước phim". Facebook phục vụ
33
+ // ÍT NHẤT hai biến thể, đổi theo phiên (cùng họ với A/B trình sửa ảnh bìa):
34
+ // 1. Nút riêng có aria-label "Tải lên"/"Upload" — không có chữ hiển thị.
35
+ // 2. Vùng thả file mang chữ "Tải video lên / hoặc kéo và thả" (aria rỗng).
36
+ // Sự cố 01/09 (idea 6a94fd58…, kênh Đồ chơi trẻ em 01, 4 lượt liên tiếp): chỉ
37
+ // biến thể 2 xuất hiện, mà danh sách cũ dò 'Tải lên' — chuỗi này KHÔNG nằm liền
38
+ // trong "Tải video lên" (có chữ "video" chen giữa) nên trượt hết, dù ảnh chụp
39
+ // lúc lỗi cho thấy nút nằm ngay đó. Thứ tự: nút chính xác trước, vùng thả sau.
40
+ const ADD_VIDEO_SELECTORS = [
41
+ "div[role='button']:has-text('Tải lên')",
42
+ "button:has-text('Tải lên')",
43
+ "[aria-label='Tải lên']",
44
+ "div[role='button']:has-text('Upload')",
45
+ "[aria-label='Upload']",
46
+ "div[role='button']:has-text('Thêm video')",
47
+ "div[role='button']:has-text('Add video')",
48
+ "[aria-label='Thêm video']",
49
+ "[aria-label='Add video']",
50
+ // Biến thể vùng thả (01/09).
51
+ "div[role='button']:has-text('Tải video lên')",
52
+ "div[role='button']:has-text('Upload video')",
53
+ "[aria-label='Tải video lên']",
54
+ "[aria-label='Upload video']",
55
+ ];
56
+
32
57
  const REEL_ENTRY_SELECTORS = [
33
58
  "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Thước phim']",
34
59
  "div[role='region'][aria-label='Tạo bài viết'] [aria-label='Reel']",
@@ -37,6 +62,14 @@ const REEL_ENTRY_SELECTORS = [
37
62
  "div[role='region'][aria-label='Create post'] [aria-label='Reels']",
38
63
  "div[role='region'][aria-label='Create post'] [aria-label='Create reel']",
39
64
  "div[role='region'][aria-label='Create post'] [aria-label='Create a reel']",
65
+ // Facebook tiếng Anh ghi "Create a post" — THỪA một chữ "a" so với biến thể
66
+ // trên. Đo thật 2026-08-30 trên profile kenh-26: region trên trang chủ là
67
+ // ["create a post","reels"], nên mọi bộ chọn 'Create post' đều trượt và kênh
68
+ // đó không đăng nổi một video nào suốt từ 14/06.
69
+ "div[role='region'][aria-label='Create a post'] [aria-label='Reel']",
70
+ "div[role='region'][aria-label='Create a post'] [aria-label='Reels']",
71
+ "div[role='region'][aria-label='Create a post'] [aria-label='Create reel']",
72
+ "div[role='region'][aria-label='Create a post'] [aria-label='Create a reel']",
40
73
  ];
41
74
  // Residential proxies can leave Facebook's final "Đang tải..." state active
42
75
  // well past three minutes. The API only declares a publish command stale after
@@ -674,7 +707,7 @@ async function runOnce({ page, payload, log }) {
674
707
  for (const region of document.querySelectorAll("[role='region'], [aria-label='Tạo bài viết']")) {
675
708
  const aria = (region.getAttribute('aria-label') || '').toLowerCase();
676
709
  if (allRegions.length < 10 && aria) allRegions.push(aria.slice(0, 30));
677
- if (!/tạo bài viết|create post/.test(aria)) continue;
710
+ if (!/tạo bài viết|create (a )?post/.test(aria)) continue;
678
711
  regionSeen++;
679
712
  for (const b of region.querySelectorAll("[role='button'], button, a")) {
680
713
  const t = (b.innerText || b.textContent || '').trim();
@@ -763,7 +796,9 @@ async function runOnce({ page, payload, log }) {
763
796
  if (await reelsDialog.isVisible({ timeout }).catch(() => false)) return reelsDialog;
764
797
  if (/\/reels\/create\/?/i.test(page.url())
765
798
  && await fullPageComposer.isVisible({ timeout: 1000 }).catch(() => false)) {
766
- const hasUploadUi = await fullPageComposer.locator("input[type='file'], [aria-label='Tải lên'], [aria-label='Upload'], [aria-label='Thêm video'], [aria-label='Add video']")
799
+ // Cùng điểm với ADD_VIDEO_SELECTORS: biến thể vùng thả không mang
800
+ // aria-label nào, chỉ có chữ hiển thị.
801
+ const hasUploadUi = await fullPageComposer.locator("input[type='file'], [aria-label='Tải lên'], [aria-label='Upload'], [aria-label='Thêm video'], [aria-label='Add video'], div[role='button']:has-text('Tải video lên'), div[role='button']:has-text('Upload video')")
767
802
  .count().catch(() => 0);
768
803
  if (hasUploadUi) return fullPageComposer;
769
804
  }
@@ -813,17 +848,7 @@ async function runOnce({ page, payload, log }) {
813
848
  // - "Tải lên" — the explicit blue upload button at the bottom (preferred)
814
849
  // - "Thêm video" — the drop-zone label (clickable on some variants)
815
850
  // - English equivalents
816
- const addVideoCandidates = [
817
- reelsRoot.locator("div[role='button']:has-text('Tải lên')"),
818
- reelsRoot.locator("button:has-text('Tải lên')"),
819
- reelsRoot.locator("[aria-label='Tải lên']"),
820
- reelsRoot.locator("div[role='button']:has-text('Upload')"),
821
- reelsRoot.locator("[aria-label='Upload']"),
822
- reelsRoot.locator("div[role='button']:has-text('Thêm video')"),
823
- reelsRoot.locator("div[role='button']:has-text('Add video')"),
824
- reelsRoot.locator("[aria-label='Thêm video']"),
825
- reelsRoot.locator("[aria-label='Add video']"),
826
- ];
851
+ const addVideoCandidates = ADD_VIDEO_SELECTORS.map(sel => reelsRoot.locator(sel));
827
852
  let videoSet = false;
828
853
  for (const loc of addVideoCandidates) {
829
854
  if (videoSet) break;
@@ -2771,5 +2796,6 @@ module.exports.__testables = {
2771
2796
  PUBLISH_ENABLE_TIMEOUT_MS,
2772
2797
  REEL_CREATE_SELECTORS,
2773
2798
  REEL_ENTRY_SELECTORS,
2799
+ ADD_VIDEO_SELECTORS,
2774
2800
  FB_REEL_CREATE_URL,
2775
2801
  };