Skip to content

fix(facebook): extract search results from role=feed entity links (#2090)#2132

Open
LeoLin990405 wants to merge 1 commit into
jackwener:mainfrom
LeoLin990405:fix/facebook-search-feed-entities
Open

fix(facebook): extract search results from role=feed entity links (#2090)#2132
LeoLin990405 wants to merge 1 commit into
jackwener:mainfrom
LeoLin990405:fix/facebook-search-feed-entities

Conversation

@LeoLin990405

Copy link
Copy Markdown
Contributor

What

opencli facebook search returned 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

  • Convert the pipeline adapter to a func (like instagram [autofix] instagram/explore: empty result (explore_grid response shape drift) #2091) so the extraction is a testable buildFacebookSearchJs(). Same site/name/access/columns; preserves the facebook search template variables not substituted #625 navigate-before-extract order (asserted by invocation-order test).
  • Scope extraction to [role="feed"].
  • Exact-host filter via new URL(): keep only facebook.com / www.facebook.com, rejecting notfacebook.com (substring impostor) and l.facebook.com / lm.facebook.com redirect shims.
  • Drop /search/ decoys.
  • Preserve query-identity params for content URLs (*.php, /watch/) so photo.php?fbid=/story.php?/watch/?v= aren't broken; strip query for vanity paths.
  • Conservative obfuscation filters (long spaceless digit tokens, spaced single-char decoys). The fuzzier ".com hidden-domain spam" filter was intentionally skipped to avoid false-dropping real results.
  • Unwrap the Browser Bridge {session,data} envelope; CommandExecutionError on 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 passed
  • check:typed-error-lint / check:silent-column-drop → no new violations
  • Codex review: ACCEPTED

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autofix] facebook/search: wrong results (role=article/listitem drift)

1 participant