Skip to content

SamJale/ai-mode-source-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

AI Mode Source Extractor

A single-file, client-side tool that lists every website Google grounded a Google AI Mode answer on, not just the handful of inline citations shown in the UI.

Built on the SearchApi.io google_ai_mode engine. No backend, no build step, no dependencies.

What it does

Google's AI Mode generates each answer from dozens of sources, but the interface only surfaces a few as inline citations. This tool makes two API calls, parses the full captured page, and recovers the complete grounding set, deduplicated by domain and stripped of Google tracking parameters.

Output: a sorted list of source URLs (and domains), with one-click copy for either, plus the answer text and the inline citations for reference.

Use cases

  • GEO / answer-engine optimization: see which domains Google actually grounds on for a query, well beyond the visible citations.
  • Visibility tracking: check whether your site is in the source set for queries you care about.
  • Content research: find the sources Google trusts for a topic before you write.
  • Competitive analysis: map which competitors get surfaced in AI Mode.

How it works

Two GET calls to SearchApi:

  1. …/api/v1/search?engine=google_ai_mode&q={query} returns the answer JSON, including search_metadata.html_url (a captured copy of the rendered page) and reference_links (the inline citations).
  2. {html_url}?api_key={key} returns the raw captured HTML.

The tool then:

  • regex-extracts every http(s) URL from the HTML,
  • strips Google tracking params (sa, ved, usg, ei, gclid, utm_*, …),
  • filters out Google's own infrastructure (gstatic, googleapis, youtube, googleusercontent, …),
  • dedupes by host, prefers deep links over bare domains, and sorts.

All processing happens in the browser. Your API key is sent only to SearchApi, so there is no third party.

Requirements

Usage

Open ai-mode-sources.html in a browser (double-click it, or host the file on any static host such as GitHub Pages). Paste your API key, enter a query, optionally set a location, and click Get all source sites.

License

MIT

About

A GEO tool that returns all citations behind Google's AI Mode answer for a given search term. A simple single-HTML front end and script, wrapped around SearchApi's google_ai_mode engine. The tool returns all sources not just the 3 inline citations.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages