channel-worker 2.5.153 → 2.5.154
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
|
@@ -211,11 +211,18 @@ function readLibraryRowsInPage() {
|
|
|
211
211
|
const r = e.getBoundingClientRect();
|
|
212
212
|
if (r && r.width > 0 && r.height > 0) { chip = t; break; }
|
|
213
213
|
}
|
|
214
|
+
// Cột "Bình luận" (chủ tịch 08/10: báo bài nhiều bình luận) đọc theo TIÊU ĐỀ
|
|
215
|
+
// CỘT, không theo số thứ tự: ô rỗng đổi chỗ theo cỡ cửa sổ (bẫy 4) nên đếm vị
|
|
216
|
+
// trí sau khi lọc là đọc nhầm cột. Tiêu đề và ô dữ liệu cùng có 14 phần tử, kể
|
|
217
|
+
// cả ô rỗng — lấy ô THÔ cùng chỉ số với tiêu đề. Số ô lệch số tiêu đề thì bỏ
|
|
218
|
+
// trống (API không ghi), đừng đoán.
|
|
219
|
+
const heads = [...document.querySelectorAll('[role="columnheader"]')].map((h) => clean(h.innerText));
|
|
220
|
+
const commentsCol = heads.findIndex((h) => /^(Bình luận|Comments)(\s|$)/i.test(h));
|
|
214
221
|
const rows = [];
|
|
215
222
|
for (const e of document.querySelectorAll('[role="row"]')) {
|
|
223
|
+
const rawCells = [...e.querySelectorAll('[role="gridcell"],[role="cell"],td')].map((c) => clean(c.innerText));
|
|
216
224
|
// BỎ Ô RỖNG trước khi đánh số — xem bẫy 4 ở đầu khối.
|
|
217
|
-
const cells =
|
|
218
|
-
.map((c) => clean(c.innerText)).filter(Boolean);
|
|
225
|
+
const cells = rawCells.filter(Boolean);
|
|
219
226
|
if (cells.length < 3) continue;
|
|
220
227
|
const head = cells[0];
|
|
221
228
|
if (/^(Bản xem trước|Preview)/i.test(head)) continue; // hàng tiêu đề
|
|
@@ -229,6 +236,7 @@ function readLibraryRowsInPage() {
|
|
|
229
236
|
viewers_text: cells[2] || '',
|
|
230
237
|
engagements_text: cells[3] || '',
|
|
231
238
|
net_followers_text: cells[4] || '',
|
|
239
|
+
comments_text: commentsCol >= 0 && rawCells.length === heads.length ? rawCells[commentsCol] : '',
|
|
232
240
|
content_id: a ? ((a.getAttribute('href') || '').match(/content_id=([^&]+)/) || [])[1] || '' : '',
|
|
233
241
|
});
|
|
234
242
|
}
|
|
@@ -328,10 +336,12 @@ async function readLibraryPage(page, log, { range = LIB_RANGE, maxSteps = LIB_MA
|
|
|
328
336
|
viewers: parseExact(r.viewers_text),
|
|
329
337
|
engagements: parseExact(r.engagements_text),
|
|
330
338
|
net_followers: parseExact(r.net_followers_text),
|
|
339
|
+
comments: parseExact(r.comments_text),
|
|
331
340
|
content_id: String(r.content_id || '').slice(0, 120),
|
|
332
341
|
});
|
|
333
342
|
}
|
|
334
|
-
|
|
343
|
+
const withComments = posts.filter((p) => p.comments != null).length;
|
|
344
|
+
log('info', `[library] ${range}: ${posts.length} bài sau ${steps} vòng cuộn — "${chip}", đọc được bình luận ${withComments}/${posts.length}`);
|
|
335
345
|
return { range, chip, posts, steps };
|
|
336
346
|
}
|
|
337
347
|
|
|
@@ -858,4 +868,4 @@ async function run({ page, payload, log }) {
|
|
|
858
868
|
return { ok: true, mode, tiles: tiles.length, written: d?.written || 0, matched: d?.matched || 0, rising: d?.rising || 0, alerts: d?.alerts || 0, followers };
|
|
859
869
|
}
|
|
860
870
|
|
|
861
|
-
module.exports = { run, __testables: { parseLibraryTime, readLibraryPage, parseViews, scrapeFollowers, parseExact, parseVnPostTime, runInsights, dumpInsightsFailure, pickRangeLabelInPage, discoverReelsTabUrl, discoverReelsTabUrls, openReelsTabWithTiles } };
|
|
871
|
+
module.exports = { run, __testables: { parseLibraryTime, readLibraryPage, readLibraryRowsInPage, parseViews, scrapeFollowers, parseExact, parseVnPostTime, runInsights, dumpInsightsFailure, pickRangeLabelInPage, discoverReelsTabUrl, discoverReelsTabUrls, openReelsTabWithTiles } };
|