channel-worker 2.5.57 → 2.5.58
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
package/scripts/lib/human.js
CHANGED
|
@@ -127,8 +127,10 @@ async function humanWheel(page, dy) {
|
|
|
127
127
|
// space / punctuation, a rare typo fixed with Backspace. Uses keyboard.type
|
|
128
128
|
// for the character itself so IME/Unicode (Vietnamese) goes through unchanged.
|
|
129
129
|
async function humanType(page, text, { typo = 0.025, base = 95 } = {}) {
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
// Duyệt theo CODE POINT, không theo đơn vị UTF-16: emoji ngoài BMP (👶 = cặp
|
|
131
|
+
// surrogate D83D DC76) mà gõ từng nửa là FB nhận 2 ký tự lỗi "��" (founder
|
|
132
|
+
// bắt được 2026-08-23 trên caption Reels); ✨ (1 đơn vị) thì không sao.
|
|
133
|
+
for (const ch of Array.from(String(text || ''))) {
|
|
132
134
|
if (typo > 0 && chance(typo) && /[a-z]/i.test(ch)) {
|
|
133
135
|
const wrong = String.fromCharCode(ch.charCodeAt(0) + (chance(0.5) ? 1 : -1));
|
|
134
136
|
await page.keyboard.type(wrong);
|
|
@@ -926,7 +926,7 @@ async function runOnce({ page, payload, log }) {
|
|
|
926
926
|
if (!f) continue;
|
|
927
927
|
try {
|
|
928
928
|
await f.click({ timeout: 3000 });
|
|
929
|
-
const descText = (fbCaption || description || title || '').toString().slice(0, 2100);
|
|
929
|
+
const descText = Array.from((fbCaption || description || title || '').toString()).slice(0, 2100).join(''); // cắt theo code point, không chặt đôi emoji
|
|
930
930
|
if (!descText) break;
|
|
931
931
|
await humanType(page, descText, { typo: 0, base: descText.length > 600 ? 60 : 95 }); // long captions: faster cadence, still keystrokes
|
|
932
932
|
// Blur commits the Lexical/React value and re-runs the form's
|
|
@@ -971,7 +971,7 @@ async function runOnce({ page, payload, log }) {
|
|
|
971
971
|
if (probe) {
|
|
972
972
|
try {
|
|
973
973
|
const f = page.locator(probe);
|
|
974
|
-
const descText = (fbCaption || description || title || '').toString().slice(0, 2100);
|
|
974
|
+
const descText = Array.from((fbCaption || description || title || '').toString()).slice(0, 2100).join(''); // cắt theo code point, không chặt đôi emoji
|
|
975
975
|
await f.click({ timeout: 3000 });
|
|
976
976
|
await humanType(page, descText, { typo: 0, base: descText.length > 600 ? 60 : 95 }); // long captions: faster cadence, still keystrokes
|
|
977
977
|
await page.keyboard.press('Tab').catch(() => {});
|