fix(facebook): extract search results from role=feed entity links (#2090) - #2132
fix(facebook): extract search results from role=feed entity links (#2090)#2132LeoLin990405 wants to merge 1 commit into
Conversation
…ckwener#2090) facebook search returned notifications/stories/live rows instead of results: the extractor keyed on [role=article]/[role=listitem], which on modern facebook.com wrap left-nav and story chrome, not results. Results now render inside [role=feed] as entity/content links, and FB injects /search/ decoy anchors plus hidden-character noise. Convert the pipeline adapter to a func (testable) that scopes extraction to [role=feed], keeps only exact-host facebook.com entity/content links (rejecting notfacebook.com substring impostors and l.facebook.com redirect shims), drops /search/ decoys, preserves query-identity params for content URLs (photo.php?fbid=/story.php?/watch/?v=), and filters conservative obfuscation (long digit tokens, spaced single-char decoys). Preserves the jackwener#625 navigate-before-extract order. Adds jsdom-fixture tests.
|
Superseding this in favor of #2194. When I opened this, What #2126 didn't catch, and what I verified is still broken by offline reproduction, is narrower: result URLs were deduped/reported as |
What
opencli facebook searchreturned notifications/stories/live rows instead of search results. Closes #2090.Root cause
The extractor keyed on
[role="article"]/[role="listitem"], which on modern facebook.com wrap left-nav and story chrome, not results. Results now render inside[role="feed"]as entity/content links (people/pages/groups/posts), and FB injects/search/decoy anchors plus hidden-character noise.Fix
pipelineadapter to afunc(like instagram [autofix] instagram/explore: empty result (explore_grid response shape drift) #2091) so the extraction is a testablebuildFacebookSearchJs(). Same site/name/access/columns; preserves the facebook search template variables not substituted #625 navigate-before-extract order (asserted by invocation-order test).[role="feed"].new URL(): keep onlyfacebook.com/www.facebook.com, rejectingnotfacebook.com(substring impostor) andl.facebook.com/lm.facebook.comredirect shims./search/decoys.*.php,/watch/) sophoto.php?fbid=/story.php?/watch/?v=aren't broken; strip query for vanity paths.{session,data}envelope;CommandExecutionErroron non-array payload.Note: I can't verify against a live logged-in FB (anti-scrape), so the DOM shape / decoy patterns follow the autofix report — happy to iterate against real results (maintainer edits enabled).
Test
clis/facebook/search.test.js— 8 tests (jsdom fixture): real person+page entities kept;/search/decoy + 16-digit token + spaced-single-char decoy + external + impostor host + redirect shim + out-of-feed nav all dropped; limit; empty feed; query-identity URLs preserved; bare-link text = anchor text; func #625 navigation order; envelope unwrap; non-array → CommandExecutionError.Verification
vitest run clis/facebook/search.test.js→ 8 passedcheck:typed-error-lint/check:silent-column-drop→ no new violations