Skip to content

fix(search): get links and descriptions correctly - #2076

Merged
mogery merged 1 commit into
mainfrom
mogery/eng-3365-bug-search-endpoint-returns-strange-descriptions
Sep 1, 2025
Merged

mogery merged 1 commit into
mainfrom
mogery/eng-3365-bug-search-endpoint-returns-strange-descriptions

Conversation

@mogery

@mogery mogery commented Sep 1, 2025

Copy link
Copy Markdown
Member

Summary by cubic

Fixes Google search scraping to return the correct result URLs and snippets. Addresses Linear ENG-3365 where the search endpoint returned strange descriptions.

  • Bug Fixes
    • Target real result links via a[href].fuLhoc.ZWRArf instead of any a[href].
    • Read snippets from span.FrIlee span.fYyStc to avoid mixed/garbled text.
    • Applied to both v1 and v2 search endpoints.

@mogery
mogery requested a review from nickscamara as a code owner September 1, 2025 09:58

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

React with 馃憤 or 馃憥 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.


for (const result of result_block) {
const link_tag = result.querySelector("a[href]") as HTMLAnchorElement;
const link_tag = result.querySelector("a[href].fuLhoc.ZWRArf") as HTMLAnchorElement;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential infinite loop when result blocks exist but no items pass stricter selectors; start/attempts never advance.

Prompt for AI agents
Address the following comment on apps/api/src/search/v2/googlesearch.ts at line 126:

<comment>Potential infinite loop when result blocks exist but no items pass stricter selectors; start/attempts never advance.</comment>

<file context>
@@ -123,9 +123,9 @@ export async function googleSearch(
 
       for (const result of result_block) {
-          const link_tag = result.querySelector(&quot;a[href]&quot;) as HTMLAnchorElement;
+          const link_tag = result.querySelector(&quot;a[href].fuLhoc.ZWRArf&quot;) as HTMLAnchorElement;
           const title_tag = link_tag ? link_tag.querySelector(&quot;span.CVA68e&quot;) : null;
-          const description_tag = result.querySelector(&quot;span.FrIlee&quot;);
</file context>

@mogery
mogery merged commit 6d86da6 into main Sep 1, 2025
10 of 11 checks passed
jerbao pushed a commit to jerbao/firecrawl-custom that referenced this pull request Aug 22, 2026
zeekay pushed a commit to Dream-AI-4444/firecrawl that referenced this pull request Sep 10, 2026
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.

1 participant