fix(facebook): extract search results from role=feed entity links (#2090)#2132
Open
LeoLin990405 wants to merge 1 commit into
Open
fix(facebook): extract search results from role=feed entity links (#2090)#2132LeoLin990405 wants to merge 1 commit into
LeoLin990405 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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