channel-worker 2.5.67 → 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 +1 -1
- package/scripts/upload_facebook.js +30 -12
package/package.json
CHANGED
|
@@ -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']",
|
|
@@ -771,7 +796,9 @@ async function runOnce({ page, payload, log }) {
|
|
|
771
796
|
if (await reelsDialog.isVisible({ timeout }).catch(() => false)) return reelsDialog;
|
|
772
797
|
if (/\/reels\/create\/?/i.test(page.url())
|
|
773
798
|
&& await fullPageComposer.isVisible({ timeout: 1000 }).catch(() => false)) {
|
|
774
|
-
|
|
799
|
+
// Cùng điểm 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')")
|
|
775
802
|
.count().catch(() => 0);
|
|
776
803
|
if (hasUploadUi) return fullPageComposer;
|
|
777
804
|
}
|
|
@@ -821,17 +848,7 @@ async function runOnce({ page, payload, log }) {
|
|
|
821
848
|
// - "Tải lên" — the explicit blue upload button at the bottom (preferred)
|
|
822
849
|
// - "Thêm video" — the drop-zone label (clickable on some variants)
|
|
823
850
|
// - English equivalents
|
|
824
|
-
const addVideoCandidates =
|
|
825
|
-
reelsRoot.locator("div[role='button']:has-text('Tải lên')"),
|
|
826
|
-
reelsRoot.locator("button:has-text('Tải lên')"),
|
|
827
|
-
reelsRoot.locator("[aria-label='Tải lên']"),
|
|
828
|
-
reelsRoot.locator("div[role='button']:has-text('Upload')"),
|
|
829
|
-
reelsRoot.locator("[aria-label='Upload']"),
|
|
830
|
-
reelsRoot.locator("div[role='button']:has-text('Thêm video')"),
|
|
831
|
-
reelsRoot.locator("div[role='button']:has-text('Add video')"),
|
|
832
|
-
reelsRoot.locator("[aria-label='Thêm video']"),
|
|
833
|
-
reelsRoot.locator("[aria-label='Add video']"),
|
|
834
|
-
];
|
|
851
|
+
const addVideoCandidates = ADD_VIDEO_SELECTORS.map(sel => reelsRoot.locator(sel));
|
|
835
852
|
let videoSet = false;
|
|
836
853
|
for (const loc of addVideoCandidates) {
|
|
837
854
|
if (videoSet) break;
|
|
@@ -2779,5 +2796,6 @@ module.exports.__testables = {
|
|
|
2779
2796
|
PUBLISH_ENABLE_TIMEOUT_MS,
|
|
2780
2797
|
REEL_CREATE_SELECTORS,
|
|
2781
2798
|
REEL_ENTRY_SELECTORS,
|
|
2799
|
+
ADD_VIDEO_SELECTORS,
|
|
2782
2800
|
FB_REEL_CREATE_URL,
|
|
2783
2801
|
};
|