channel-worker 2.5.48 → 2.5.49
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/nurture_facebook.js +20 -1
package/package.json
CHANGED
|
@@ -170,11 +170,25 @@ async function scanFeed(page, { skipKeys = [], wantLike = false } = {}) {
|
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
// Which element is actually scrolling? Facebook has shipped both a
|
|
174
|
+
// window-scrolled feed and one inside its own overflow container; if we
|
|
175
|
+
// measure the wrong one, "the page didn't move" is a false alarm.
|
|
176
|
+
let scroller = 'window', scrollTop = Math.round(window.scrollY || 0);
|
|
177
|
+
if (!scrollTop) {
|
|
178
|
+
for (const el of document.querySelectorAll('div')) {
|
|
179
|
+
if (el.scrollTop > 50 && el.scrollHeight > el.clientHeight + 200) {
|
|
180
|
+
scroller = 'div.' + String(el.className || '').split(' ')[0];
|
|
181
|
+
scrollTop = Math.round(el.scrollTop);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
173
186
|
return {
|
|
174
|
-
posts, likeKey,
|
|
187
|
+
posts, likeKey, scroller, scrollTop,
|
|
175
188
|
scrollY: Math.round(window.scrollY || document.documentElement.scrollTop || 0),
|
|
176
189
|
articlesInDom: units.length,
|
|
177
190
|
selector: sel || '(none)',
|
|
191
|
+
sample: posts.slice(0, 3).map((p) => p.key.slice(0, 46)),
|
|
178
192
|
};
|
|
179
193
|
}, { skip: skipKeys, wantLike }).catch(() => ({ posts: [], likeKey: null, scrollY: 0, articlesInDom: 0 }));
|
|
180
194
|
}
|
|
@@ -385,6 +399,11 @@ async function run({ page, payload, log }) {
|
|
|
385
399
|
seenKeys.add(p.key);
|
|
386
400
|
if (!p.isAd) fresh++; // scrolling past an ad isn't reading
|
|
387
401
|
}
|
|
402
|
+
// debug:true (probe runs only) — dumps what the scan actually saw so a
|
|
403
|
+
// wrong selector / duplicate key shows up as data instead of a guess.
|
|
404
|
+
if (payload.debug && ticks % 3 === 0) {
|
|
405
|
+
log('info', `[nurture-fb][dbg] t${ticks} scroller=${scan.scroller}@${scan.scrollTop} winY=${scan.scrollY} sel=${scan.selector} units=${scan.articlesInDom} fresh=${fresh} keys=${JSON.stringify(scan.sample)}`);
|
|
406
|
+
}
|
|
388
407
|
postsSeen += fresh;
|
|
389
408
|
postsSinceLike += fresh;
|
|
390
409
|
// Feed that stops yielding posts for ~15 ticks = end of feed, a wall, or a
|