<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Noraina Nordin</title>
    <description>The latest articles on DEV Community by Noraina Nordin (@noraina_nordin).</description>
    <link>https://dev.to/noraina_nordin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3507733%2F1461b4c2-fd45-4638-bf48-ebce4648a5c2.jpeg</url>
      <title>DEV Community: Noraina Nordin</title>
      <link>https://dev.to/noraina_nordin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/noraina_nordin"/>
    <language>en</language>
    <item>
      <title>How to Do SEO Research with Claude Desktop and SerpApi MCP</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Wed, 24 Jun 2026 15:09:47 +0000</pubDate>
      <link>https://dev.to/serpapi/how-to-do-seo-research-with-claude-desktop-and-serpapi-mcp-1a0c</link>
      <guid>https://dev.to/serpapi/how-to-do-seo-research-with-claude-desktop-and-serpapi-mcp-1a0c</guid>
      <description>&lt;p&gt;Most SEO research workflows feel like tab management. You open Ahrefs, Semrush, or any SEO tools for keyword data, flip to Google for SERP analysis, copy results into a doc, paste context back into your AI tool, and start over. Every tool switch breaks your chain of thought.&lt;/p&gt;

&lt;p&gt;There's a better way. By connecting SerpApi's MCP server to Claude Desktop, you can run live SERP lookups, keyword research, competitor analysis, and content gap checks inside a single chat window, without touching a browser.&lt;/p&gt;

&lt;p&gt;This post walks through how to set it up, the prompts that make it useful, and the SEO research workflows worth building into your daily routine.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why ask Claude for SEO data when it makes up numbers?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you've ever asked a chatbot for search volumes or "the top ranking pages" for a keyword, you've seen the problem: it answers confidently and it's often wrong. Language models don't have a live index. They approximate it by inventing volumes, guessing at competitors, and describing a SERP from months or years ago.&lt;/p&gt;

&lt;p&gt;That's the gap the&lt;a href="https://serpapi.com/blog/model-context-protocol-mcp-a-unified-standard-for-ai-agents-and-tools/" rel="noopener noreferrer"&gt;Model Context Protocol (MCP)&lt;/a&gt; closes. MCP lets Claude call external tools and pull real data into the conversation. Point it at the&lt;a href="https://serpapi.com/blog/introducing-serpapis-mcp-server/" rel="noopener noreferrer"&gt;SerpApi MCP server&lt;/a&gt; and Claude stops guessing about Google and starts reading the actual results page for the organic positions, the People Also Ask box, autocomplete suggestions, AI Overview citations, and more. It's all fetched in real time, structured, and ready to reason over.&lt;/p&gt;

&lt;p&gt;So the honest answer to "Is Claude good for SEO?" is: not on its own, but impressively so once it can see live data. The model is the analyst. SerpApi is the eyes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before You Start
&lt;/h2&gt;

&lt;p&gt;Already have SerpApi MCP connected to Claude Desktop? Skip ahead.&lt;/p&gt;

&lt;p&gt;If not, we've covered the full setup in &lt;a href="https://serpapi.com/blog/how-to-connect-serpapi-mcp-to-claude-desktop/" rel="noopener noreferrer"&gt;Connecting Web Search to Claude Desktop with SerpApi MCP&lt;/a&gt;. It takes about five minutes. Come back here when you're ready.&lt;/p&gt;

&lt;p&gt;SerpApi's free plan includes 250 searches per month. It's enough to run a complete research session on a keyword before you commit to a paid plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  SEO Research Workflows with Claude
&lt;/h2&gt;

&lt;p&gt;Before the workflow, one rule that separates useful AI research from the autopilot content that floods this space: &lt;strong&gt;Claude fetches and analyzes and you make the calls.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Search strategy is full of judgments that didn't survive automation: whether a SERP is winnable, when "high volume" is a trap because the results are all video or Reddit. If you let the model decide all of that unsupervised, you get average output that looks like everyone else's. Keep yourself in the loop at each decision point. The prompts below are written that way: they ask Claude to surface and structure, then hand the decision back to you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvgz4zbekyzbw9fbt82m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvgz4zbekyzbw9fbt82m.png" alt="SEO research workflow with Claude" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SEO research workflow with Claude&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📝 The example results shown throughout this post use " &lt;strong&gt;natural skincare products&lt;/strong&gt;" as the keyword, but the prompts are industry-agnostic. Swap in your own keyword, and they work just as well for SaaS, finance, travel, or any other niche.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Workflow 1: Organic SERP Analysis
&lt;/h3&gt;

&lt;p&gt;Start by reading the battlefield. You want to know who ranks, what format wins, and &lt;a href="https://ahrefs.com/blog/search-intent/" rel="noopener noreferrer"&gt;what intent Google is actually rewarding&lt;/a&gt; before you commit to an angle. This step leans on SerpApi's&lt;a href="https://serpapi.com/search-api" rel="noopener noreferrer"&gt;Google Search API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP, run a Google search for [your keyword] and return the top 10 organic results. For each, give me the title, domain, and a one-line read on the content type (guide, tool, forum thread, video, etc.). Then summarize: what intent is Google rewarding, what formats dominate, and is there a content type that's missing?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Read the output like a competitor would. A few things to look for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Format of the winners.&lt;/strong&gt; If the first page is mostly YouTube and Reddit, that's a signal that long-form may be underserved, which is an opening, not a wall.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intent mismatch.&lt;/strong&gt; If you planned a product page but the SERP is all how-to guides, the SERP is telling you what it wants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who owns the topic.&lt;/strong&gt; A single authoritative guide ranking #1 is a different challenge than ten thin posts splitting the results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't skip the reading and let Claude declare a winner. The pattern you notice here shapes everything downstream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6nuqpwgm6k43annch2lr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6nuqpwgm6k43annch2lr.png" alt="Top-10 organic SERP results with a content type for each result" width="800" height="709"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Top-10 organic SERP results with a content type for each result&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Workflow 2: Autocomplete for Keyword Clusters
&lt;/h3&gt;

&lt;p&gt;Google Autocomplete shows how people actually phrase their searches. It's where you find the modifiers, the long-tail variants, and the sub-intents worth their own sections. SerpApi exposes this through the&lt;a href="https://serpapi.com/google-autocomplete-api" rel="noopener noreferrer"&gt;Google Autocomplete API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP autocomplete engine, pull suggestions for [your keyword] and 2–3 close variants. Group the results into thematic clusters (e.g. setup, comparisons, use cases, pricing). Flag which clusters look like separate articles versus sections within one piece.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The grouping is the value. A flat list of fifty suggestions is noise; three or four clusters are a content plan. Watch for the dominant modifiers; they tell you what shape of content the audience expects. (For a tooling topic, for instance, words like "skill," "prompt," "audit," and "agent" recurring across suggestions signal that people want repeatable workflows, not theory.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1cios8qmwv0zz7b5pqp6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1cios8qmwv0zz7b5pqp6.png" alt="Raw autocomplete suggestions grouped into thematic keyword clusters" width="800" height="667"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Raw autocomplete suggestions grouped into thematic keyword clusters&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Workflow 3: People Also Ask Mining
&lt;/h3&gt;

&lt;p&gt;The People Also Ask (PAA) box is a direct readout of the questions Google associates with your topic and is available via the&lt;a href="https://serpapi.com/google-related-questions-api" rel="noopener noreferrer"&gt;Google Related Questions API&lt;/a&gt;. Each one is a candidate subheading, an FAQ entry, or an answer block that can earn a featured snippet or an AI citation. Because &lt;a href="https://searchengineland.com/guide/people-also-ask" rel="noopener noreferrer"&gt;PAA often surfaces content from pages ranking outside the top 10&lt;/a&gt;, it can put you on page one even when your main ranking isn't there yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP, pull the People Also Ask questions for [your keyword]. Group them by sub-theme, and for each, tell me whether it belongs as an H2 in the main article, an FAQ entry, or its own page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Two things make PAA mining pay off.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Answer the highest-intent questions early and plainly. A clean, self-contained answer near the top of your page is exactly what both featured snippets and AI Overviews pull from. &lt;/li&gt;
&lt;li&gt;Use the leftover questions to seed an FAQ section that mirrors how people actually ask, in their own words.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq6b7398tphb1szd56yyc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq6b7398tphb1szd56yyc.png" alt="PAA questions classified into main-article H2, FAQ entries, and standalone pages" width="800" height="751"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PAA questions classified into main-article H2, FAQ entries, and standalone pages&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Workflow 4: Google Trends for Topic Momentum
&lt;/h3&gt;

&lt;p&gt;Google Trends tells you when and whether the audience for your topic is growing or shrinking before you invest in it.&lt;/p&gt;

&lt;p&gt;SerpApi exposes three &lt;a href="https://serpapi.com/google-trends-api" rel="noopener noreferrer"&gt;Google Trends API&lt;/a&gt; data types that are useful at different stages of research.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://serpapi.com/google-trends-interest-over-time" rel="noopener noreferrer"&gt;Google Trends Interest Over Time API&lt;/a&gt;: shows interest over time and answers questions such as "is this topic rising, peaking, or fading?"&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://serpapi.com/google-trends-related-queries" rel="noopener noreferrer"&gt;Google Trends Related Queries API&lt;/a&gt;: surfaces rising queries. For example, terms that have recently seen significant growth in search volume but don't yet have much content competing for them. That's where early-mover opportunities live.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://serpapi.com/google-trends-trending-now" rel="noopener noreferrer"&gt;Google Trends Trending Now API&lt;/a&gt;: While &lt;code&gt;TIMESERIES&lt;/code&gt; and &lt;code&gt;RELATED_QUERIES&lt;/code&gt; are strategic tools for planning ahead, Trending Now is tactical. It shows what's spiking in real time across Google Search, updated continuously, with search volume and the related queries driving each spike. For content teams, it's newsjacking radar. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Prompt for trend validation:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP with engine "google_trends" and data_type "TIMESERIES", compare these terms over the past 12 months: [your keyword], [close variant 1], [close variant 2]. Summarize the trajectory of each — is interest growing, flat, or declining? Are there seasonal patterns? Based on the pattern, what does the timing suggest for publishing?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What to look at in the output:&lt;/p&gt;

&lt;p&gt;You want to know whether you're writing into a rising wave, a fading one, or a predictable seasonal cycle. A seasonal pattern is a publishing strategy. A declining trend is a reason to rethink the angle. Stable but flat means the audience exists — the question is whether you can take share.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbz9yujjf2574f0rbb5ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbz9yujjf2574f0rbb5ux.png" width="800" height="722"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt for rising related queries:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP with engine "google_trends" and data_type "RELATED_QUERIES", pull rising queries for [your primary keyword] over the past 12 months. List the rising results separately from the top results, sorted by growth rate. For each, tell me whether it looks like a content opportunity, a competitor signal, or noise.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F28nqoipk7dnythje3nwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F28nqoipk7dnythje3nwu.png" alt="Rising related queries surfaced through SerpApi MCP" width="800" height="727"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rising related queries surfaced through SerpApi MCP&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The rising list is your editorial calendar in early form. Terms growing 50–100% over 12 months represent topics your audience is just starting to search — meaning little content exists yet and ranking potential is high for whoever publishes first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt for real-time topics:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP with engine "google_trends_trending_now" and geo "US", return the top trending searches right now. For each trend, show the query, search volume, increase percentage, category, and the top 3 related breakdown queries. Flag any that are relevant to [your industry or topic] and suggest a reactive content angle for each.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftbp41x8n2e8azgmnmw2v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftbp41x8n2e8azgmnmw2v.png" alt="Google Trends Trending Now surfaced through SerpApi MCP" width="800" height="710"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Google Trends Trending Now surfaced through SerpApi MCP&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Trending Now is most useful when you have a content workflow that can publish the same day. What's trending at 9 a.m. may be gone by noon. It's less relevant for evergreen articles, but valuable for reactive pieces tied to product launches, seasonal events, or breaking news in your space.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workflow 5: From Data to a Content Brief
&lt;/h3&gt;

&lt;p&gt;Now synthesize. You've got the competitive landscape, the keyword clusters, the questions, and the trends signal. Hand it all back to Claude and ask it to build the brief.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Based on the organic results, autocomplete clusters, PAA questions, and Trends data we just pulled, draft a content brief: (1) a recommended angle that targets a gap in what currently ranks, (2) a suggested H1, (3) an outline of H2s that covers the clusters and answers the top questions, and (4) 3–5 supporting keywords to use naturally. For each recommendation, point to the specific data that justifies it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The "justify it with the data" instruction matters. It keeps Claude grounded in what you pulled rather than drifting into generic SEO advice. You review, you adjust, you decide. The brief is a draft of your thinking, not a replacement for it.&lt;/p&gt;

&lt;p&gt;If you've been following along with a real keyword, you'll notice this article was built with exactly this workflow. The process is reproducible, and you just watched it run.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Researching for the AI-search era (GEO/AEO)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here's the part that's quietly becoming the whole game. Ranking in classic blue links is no longer the only target. You also want to be the source that AI Overviews, ChatGPT, Perplexity, and Claude itself cite when they answer a question. That discipline goes by a few names: generative engine optimization (GEO) or answer engine optimization (AEO).&lt;/p&gt;

&lt;p&gt;SerpApi gives Claude something most setups can't here: access to&lt;a href="https://serpapi.com/google-ai-overview-api" rel="noopener noreferrer"&gt;Google AI Overview&lt;/a&gt; data, including which sources get cited for a query. (For the conversational side of AI search, there's also the&lt;a href="https://serpapi.com/google-ai-mode-api" rel="noopener noreferrer"&gt;Google AI Mode API&lt;/a&gt;.) That turns "how do I get cited?" from a guess into a research question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Using the SerpApi MCP, pull the AI Overview for [your keyword] and list the sources it cites. What do those sources have in common — format, depth, structure? Then compare to my page at [URL] and tell me what's making them citeable that I'm missing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqqds9je29m3rjwwhb29e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqqds9je29m3rjwwhb29e.png" alt="AI Overview sources compared against your page to find the citeability gap" width="800" height="776"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;AI Overview sources compared against your page to find the citeability gap&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ahrefs.com/blog/how-to-rank-in-ai-overviews/" rel="noopener noreferrer"&gt;Citeable content tends to share traits&lt;/a&gt;: clear, self-contained answers; specific data; structure a model can parse. Researching the citation pattern for your own topics rather than reading generic GEO advice is where the real edge is, and it's a capability the video tutorials dominating this SERP can't easily demonstrate.&lt;/p&gt;

&lt;h2&gt;
  
  
  What This Replaces and What It Doesn't
&lt;/h2&gt;

&lt;p&gt;This setup is excellent for: SERP analysis, content ideation, competitor research, PAA mining, trend monitoring, and building content briefs.&lt;/p&gt;

&lt;p&gt;It doesn't replace dedicated keyword research tools like Ahrefs or Semrush for volume data, KD scores, and traffic potential. Those require a separate tool with their own indexed databases. The best workflow pairs both: use Ahrefs (or your preferred keyword tool) to validate search volume and difficulty, and use Claude + SerpApi for the qualitative SERP analysis that keyword tools don't give you.&lt;/p&gt;

&lt;p&gt;The combination is a lean, powerful research stack that lives entirely inside Claude.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Going Further&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This research workflow is one slice of what the connection makes possible. For more workflows in the same vein, see&lt;a href="https://serpapi.com/blog/top-5-practical-use-cases-for-serpapi-mcp-server-in-ai-agents/" rel="noopener noreferrer"&gt;the top 5 practical use cases for the SerpApi MCP server&lt;/a&gt;. And when you're ready to move from a chat window to something automated such as a daily competitor-monitoring agent, the same MCP works in developer environments too: there are guides for&lt;a href="https://serpapi.com/blog/integrating-serpapi-mcp-into-your-developer-workflow/" rel="noopener noreferrer"&gt;integrating SerpApi MCP into a developer workflow&lt;/a&gt; and for&lt;a href="https://serpapi.com/blog/build-an-ai-agent-with-claude-agent-sdk/" rel="noopener noreferrer"&gt;building an AI agent with the Claude Agent SDK&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is Claude good for SEO?&lt;/strong&gt; On its own, it's a strong writing and analysis partner, but an unreliable source of search data; it will approximate volumes and SERPs. Connected to live data through an MCP server like SerpApi, it becomes genuinely useful for research because it reasons over real results rather than guessing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which AI is best for SEO?&lt;/strong&gt; There's no single winner; it depends on the job. Claude is particularly strong for long-context analysis, reading multiple competitor pages, transcripts, or large datasets in one pass, and for structured reasoning. What matters more than the model is whether it's connected to real SERP data and whether you keep your own judgment in the loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I use Claude specifically for SEO research?&lt;/strong&gt; Connect it to a live data source via MCP, then run a structured session: read the organic SERP, mine autocomplete for clusters, pull People Also Ask questions, and synthesize those into a brief. Treat Claude as the analyst who fetches and structures, and make the strategic calls yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is SEO dead or evolving in 2026?&lt;/strong&gt; Evolving, not dead. The demand for trustworthy, authoritative content hasn't gone anywhere. What's changed is that visibility now spans both traditional rankings and AI-generated answers. Research workflows that account for citeability, not just keywords, are how you stay visible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Claude Desktop + SerpApi MCP turns a general-purpose AI assistant into a live SEO research tool. The setup takes five minutes. The prompts above cover the core research tasks you do before and during content creation. And because everything runs in one chat window, you keep the context that gets lost when you're jumping between tools.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Real Estate Data API for PropTech Developers</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Tue, 23 Jun 2026 15:07:57 +0000</pubDate>
      <link>https://dev.to/serpapi/real-estate-data-api-for-proptech-developers-2n3a</link>
      <guid>https://dev.to/serpapi/real-estate-data-api-for-proptech-developers-2n3a</guid>
      <description>&lt;p&gt;A few years ago, I moved to Zaragoza, Spain. A city that I'd never set foot in before. I spend hours on Google Maps manually searching for "gyms near [address]," "restaurants near [address]," "metro stations near [address]" — trying to piece together which neighborhoods were safe, convenient, and actually livable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I was doing the job that PropTech platforms should be provided.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I picked an apartment that looked good on the real estate platform. Within a year, I moved again. This time, to a neighborhood I'd discovered after being there in person. The stress of moving twice? I wouldn't wish that on anyone.&lt;/p&gt;

&lt;p&gt;The users, especially those relocating to unfamiliar cities, are facing this exact problem every day. And every time they leave your platform to research neighborhoods on Google Maps, you've lost them.&lt;/p&gt;

&lt;p&gt;The platforms winning right now aren't the ones with the most listings. They're the ones delivering location intelligence at scale that automatically enriches every property with the context users need to make confident decisions.&lt;/p&gt;

&lt;p&gt;This is the opportunity. And this is how to build it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Digital Ecosystem Demand Location Intelligence
&lt;/h2&gt;

&lt;p&gt;According to &lt;a href="https://www.finehomesandliving.com/luxury_homes/how-proptech-platforms-are-reshaping-the-real-estate-industry-in-2025/article_351d2a59-5647-479d-8ae9-037559bc55c7.html" rel="noopener noreferrer"&gt;Fine Magazines&lt;/a&gt;, in 2025, real estate platforms function as digital ecosystems, offering AI-driven recommendations, virtual tours, and neighborhood insights all in one place. Users expect to browse listings, explore neighborhoods, and make decisions without leaving the platforms.&lt;/p&gt;

&lt;p&gt;But building these ecosystems requires data. Specifically, structured location data that can power recommendations, extract nearby amenities, and provide neighborhood context at scale. That's where a real estate data API stack comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Property Research Problem No One Talks About
&lt;/h2&gt;

&lt;p&gt;My Zaragoza experience isn't unique. There are millions of users relocating every year to cities they've never visited. They need neighborhood context. And right now, most PropTech platforms can't deliver it.&lt;/p&gt;

&lt;p&gt;Here's what most PropTech founders won't admit publicly: their 'neighborhood data' is a patchwork of manual research, outdated datasets, and educated guesses.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Finding that data fragmentation, inconsistent quality, and high access cost remain major stumbling blocks across UK, USA, China, and India"  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.wbs.ac.uk/news/proptech-revolution-hampered-by-lack-of-high-quality-data/" rel="noopener noreferrer"&gt;A 2025 report from Warwick Business School&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Without a scalable real estate data API solution, the symptoms show up everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Listing goes live half-empty&lt;/strong&gt;. Square footage? Check. Photos? Check. What's within walking distance? "TBD"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users bounce&lt;/strong&gt;. Every time a buyer or renter opens a listing, they need to confirm the location and the nearby area on Google Maps, GreatSchools, or Reddit to fill in the gaps your platform left; you've lost their attention. Worse, you've trained them to see your platform as incomplete. The platform winning today keeps the user experience inside. Surfacing school ratings, transit times, and local amenities without forcing users to research for themselves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your team becomes a bottleneck&lt;/strong&gt;. Every new market you enter means more manual research. More hours. More inconsistency. Your growth is literally capped by how many browser tabs your team can keep open.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Address data is a mess&lt;/strong&gt;. User types "123 Main St", twelve different ways. Your database has duplicates, typos, and listings that don't actually exist. Search becomes unreliable. Trust erodes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Meanwhile, your competitors, who are the ones raising bigger rounds and signing enterprise deals, have already solved this problem. They've built a real estate data API stack that automates what your team still does manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Winning PropTech Platforms Do Differently
&lt;/h2&gt;

&lt;p&gt;The platforms pulling ahead aren't working harder. They're not hiring armies of researchers. They've built a real estate data API stack that powers automated location intelligence across their entire infrastructure.&lt;/p&gt;

&lt;p&gt;Think about what users like me actually needed when apartment hunting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nearby amenities:&lt;/strong&gt; Grocery stores, gyms, restaurants, and parks within walking distance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public transport access:&lt;/strong&gt; Tram or metro stations, bus lines, and commute times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neighborhood quality:&lt;/strong&gt; Is this area lively or dead? Safe or sketchy?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified addresses:&lt;/strong&gt; Is this listing even real?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Winning platforms answer all of these questions automatically at scale for every listing.&lt;/p&gt;

&lt;p&gt;Here's what a property listing enrichment looks like in practice:&lt;/p&gt;

&lt;h3&gt;
  
  
  Help users find the right location.
&lt;/h3&gt;

&lt;p&gt;When users search for properties, typos and incomplete queries lead to frustration. For example, they type "Av de Goya, 90". With SerpApi's &lt;a href="https://serpapi.com/google-maps-autocomplete-api" rel="noopener noreferrer"&gt;Google Maps Autocomplete API&lt;/a&gt; it will show you autocomplete suggestions, reducing errors, guiding them to real places, and returning coordinates which you can use for further enrichment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flaqotkczfiehau8dkug8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flaqotkczfiehau8dkug8.png" alt="Results from SerpApi's Google Maps Autocomplete Playground" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Results from SerpApi's Google Maps Autocomplete Playground&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What's around this property?
&lt;/h3&gt;

&lt;p&gt;When a listing enters the system, it will automatically be tagged with nearby context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Schools (with rating and distance).&lt;/li&gt;
&lt;li&gt;Hospitals, pharmacies, and urgent care facilities.&lt;/li&gt;
&lt;li&gt;Public transit stops and commute times.&lt;/li&gt;
&lt;li&gt;Grocery stores, restaurants, gyms, banks, parks, and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With SerpApi's &lt;a href="https://serpapi.com/google-maps-api" rel="noopener noreferrer"&gt;Google Maps API&lt;/a&gt;, a single API call returns ratings, reviews, exact addresses, hours, and GPS coordinates for any location.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk34kt2jjygdn23wjp2wu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fk34kt2jjygdn23wjp2wu.png" alt="Results from SerpApi's Google Maps Playground" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Results from SerpApi's Google Maps Playground&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The image above shows an example result from &lt;a href="https://serpapi.com/playground?engine=google_maps&amp;amp;q=pharmacies&amp;amp;ll=%4041.6469396%2C-0.896098%2C14z&amp;amp;hl=en&amp;amp;type=search" rel="noopener noreferrer"&gt;our playground&lt;/a&gt;. You can set the coordinates from the address and send the search query. In this example, the results show the available pharmacies around "Avenida Francisco de Goya, 90" including their details such as opening hours, full address, phone numbers and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's missing here?
&lt;/h3&gt;

&lt;p&gt;Users don't just want to know what's nearby, they also want to know what's not there.&lt;/p&gt;

&lt;p&gt;No grocery store within walking distance? That's a dealbreaker for some. Only a few restaurants in the area? The neighborhood might be too quiet for other. No gyms nearby? Fitness-focus renters will look elsewhere.&lt;/p&gt;

&lt;p&gt;With the same &lt;a href="https://serpapi.com/google-maps-api" rel="noopener noreferrer"&gt;Google Maps API&lt;/a&gt;, you can send query by category and identify the gaps that matter to users. This will help them to make a better decision before they commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's the distance between the home and ... ?
&lt;/h3&gt;

&lt;p&gt;Users don't just want to know what's nearby; they want to know how long it takes to get there. Commute time to work, walking distance to the public transport, or driving time to the nearest school.&lt;/p&gt;

&lt;p&gt;With SerpApi's &lt;a href="https://serpapi.com/google-maps-directions-api" rel="noopener noreferrer"&gt;Google Maps Direction API&lt;/a&gt;, you can extract travel times between any two points by car, transit, walking, or cycling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwz8j4eow7408i8nvg5bg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwz8j4eow7408i8nvg5bg.png" alt="Result from SerpApi's Google Maps Direction playground" width="799" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Result from SerpApi's Google Maps Direction playground&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We return structured direction data including the steps it took for every directions giving users a clear picture of their daily commute. By default, it shows the result for the best travel mode. However, you can cutomize by setting the &lt;code&gt;travel_mode&lt;/code&gt; parameters.&lt;/p&gt;

&lt;p&gt;Read the full tutorial on how to set up the Google Maps Directions with Python in the blog post below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/blog/get-accurate-route-data-scraping-google-maps-directions/" rel="noopener noreferrer"&gt;Get Accurate Route Data: Scraping Google Maps Directions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Is this a good neighborhood?
&lt;/h3&gt;

&lt;p&gt;This is the question every user asks and the hardest one to answer at scale.&lt;/p&gt;

&lt;p&gt;While this topic isn't 100% of the PropTech platform's job to judge, at least you can give users the data to decide for themselves. High-rated coffee shops, busy restaurants, and well-reviewed local services can be a good indicator of a healthy neighborhood.&lt;/p&gt;

&lt;p&gt;With SerpApi's &lt;a href="https://serpapi.com/google-maps-reviews-api" rel="noopener noreferrer"&gt;Google Maps Reviews API&lt;/a&gt;, you can aggregate user reviews and sentiment data from local businesses by extracting ratings, reviews counts,review snippets, images (if it was uploaded) price range for every restaurants and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feayltwcym67pf4n450ub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feayltwcym67pf4n450ub.png" alt="Result from SerpApi's Google Maps Reviews playground" width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Result from SerpApi's Google Maps Reviews playground&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the example above we can see the details review. Even though the review is in Spanish, SerpApi returns to you both the original language and english translation making it easy to analyze sentiment regardless of location.&lt;/p&gt;

&lt;p&gt;Read the full tutorial on how to set up the Google Maps Reviews with Python in the blog post below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/blog/how-to-scrape-google-maps-reviews/" rel="noopener noreferrer"&gt;How to scrape Google Maps Reviews&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Real Cost of Waiting
&lt;/h2&gt;

&lt;p&gt;Every day your platforms run without automated location intelligence, you're:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Losing users to competitors with better real estate amenities mapping&lt;/li&gt;
&lt;li&gt;Burning money on manual research that doesn't scale&lt;/li&gt;
&lt;li&gt;Missing opportunities because you can't see market gaps&lt;/li&gt;
&lt;li&gt;Building technical debt with messy address data that will haunt you later&lt;/li&gt;
&lt;li&gt;Watching users bounce to Google Maps, Yelp and etc to do research you should have provided.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The PropTech platforms that will dominate the next decade aren't the ones with the most listings. They're the ones delivering the most context around their listing.&lt;/p&gt;

&lt;p&gt;A robust real estate data API stack isn't a feature anymore. It's the foundation of every successful PropTech location intelligence strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why SerpApi Instead of Google Maps API Directly?
&lt;/h2&gt;

&lt;p&gt;Google's Official Places API provides similar structured data, such as nearby places, reviews, and directions. So why use SerpApi?&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Differences
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Google Maps Platform&lt;/th&gt;
&lt;th&gt;SerpApi&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pricing Model&lt;/td&gt;
&lt;td&gt;Pay-per-request with&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tiered volume discount&lt;/td&gt;
&lt;td&gt;Flat monthly plans&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Variable. Depends on usage&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mix and SKUs&lt;/td&gt;
&lt;td&gt;Fixed monthly cost&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data availability&lt;/td&gt;
&lt;td&gt;Some browser-visible&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;data not exposed&lt;br&gt;&lt;br&gt;
 (e.g., Popular Times) | Returns data as seen&lt;br&gt;&lt;br&gt;
 on Google Maps on browsers or apps,&lt;br&gt;&lt;br&gt;
 including Popular Times |&lt;br&gt;
| Field selection | Must specify fields&lt;br&gt;&lt;br&gt;
 via &lt;code&gt;X-Goog_FieldMask&lt;/code&gt;&lt;br&gt;&lt;br&gt;
 and different fields&lt;br&gt;&lt;br&gt;
 have &lt;a href="https://developers.google.com/maps/documentation/places/web-service/nearby-search#fieldmask:~:text=Field%20masking%20is%20a%20good%20design%20practice%20to%20ensure%20that%20you%20don%27t%20request%20unnecessary%20data%2C%20which%20helps%20to%20avoid%20unnecessary%20processing%20time%20and%20billing%20charges." rel="noopener noreferrer"&gt;different cost&lt;/a&gt; (&lt;a href="https://developers.google.com/maps/documentation/places/web-service/data-fields" rel="noopener noreferrer"&gt;see full list&lt;/a&gt;) | Returns all available data&lt;br&gt;&lt;br&gt;
 in one response.&lt;br&gt;&lt;br&gt;
 No field management needed |&lt;br&gt;
| Terms of Service | Strict.&lt;br&gt;&lt;br&gt;
 Caching limits,&lt;br&gt;&lt;br&gt;
 display requirements (&lt;a href="https://cloud.google.com/maps-platform/terms?hl=en" rel="noopener noreferrer"&gt;ToS&lt;/a&gt;) | More flexible.&lt;br&gt;&lt;br&gt;
 You can store your own data |&lt;br&gt;
| Multi-source | Google data only | Google, Bing, Yelp and more |&lt;br&gt;
| Setup | Requires Google Cloud&lt;br&gt;&lt;br&gt;
 account and billing | Simple API key |&lt;br&gt;
| Billing Complexity | Multiple SKUs with&lt;br&gt;&lt;br&gt;
 different rates | One search = One credit |&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note on Popular Time:&lt;/strong&gt; If you've ever looked at a business on Google Maps and seen the bar chart showing when it's the busiest, that's "Popular Time" data. It's valuable for PropTech platform (imagine showing users when nearby gyms or coffee shops are crowded). Google's official API does not expose this data. SerpApi returns it through the &lt;code&gt;place_results&lt;/code&gt; endpoint requiring a second API call using the &lt;code&gt;place_id&lt;/code&gt; from your initial &lt;code&gt;local_results&lt;/code&gt; search. While it's an extra step, the data itself is available and structured as a &lt;code&gt;busyness_score&lt;/code&gt; per hour for each day of the week.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note on FieldMask:&lt;/strong&gt; Google's Places API (New) requires you to specify exactly which fields you want in every request using &lt;code&gt;X-Goog-FieldMask&lt;/code&gt;. Different fields fall into different pricing tiers (Essentials, Pro, Enterprise) so requesting &lt;code&gt;reviews&lt;/code&gt; costs more than requesting &lt;code&gt;displayName&lt;/code&gt;. This adds complexity to both your code and your billing. With SerpApi, you get all available data in one response with predictable pricing.&lt;/p&gt;

&lt;h3&gt;
  
  
  When Each Makes Sense
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Choose Google Maps Platform if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need map visualization (Maps JavaScript API)&lt;/li&gt;
&lt;li&gt;You require official support and SLAs&lt;/li&gt;
&lt;li&gt;You have high volume (250K+ calls) where subscription pricing is cost-effective&lt;/li&gt;
&lt;li&gt;Enterprise requirements mandate official APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choose SerpApi if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You want simple, predictable monthly costs&lt;/li&gt;
&lt;li&gt;You need data from multiple sources (Google + Bing + Yelp)&lt;/li&gt;
&lt;li&gt;You want all data returned without managing field masks&lt;/li&gt;
&lt;li&gt;You need Popular Times or other browser-visible data&lt;/li&gt;
&lt;li&gt;You need more flexibility in how you store and use the data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Beyond Google Maps: Multiple Data Sources
&lt;/h2&gt;

&lt;p&gt;SerpApi isn't limited to Google Maps. You can enrich your listings with data from multiple sources through a single API provider:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data Source&lt;/th&gt;
&lt;th&gt;API&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Google Maps&lt;/td&gt;
&lt;td&gt;&lt;a href="https://serpapi.com/google-maps-api" rel="noopener noreferrer"&gt;Google Maps API&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nearby places, directions, reviews, autocomplete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bing Maps&lt;/td&gt;
&lt;td&gt;&lt;a href="https://serpapi.com/bing-maps-api" rel="noopener noreferrer"&gt;Bing Maps API&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Alternative location data, different coverage areas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yelp&lt;/td&gt;
&lt;td&gt;&lt;a href="https://serpapi.com/yelp-search-api" rel="noopener noreferrer"&gt;Yelp Search API&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Restaurant ratings, local business reviews, neighborhood vibe&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why Use Multiple Sources?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Richer data:&lt;/strong&gt; Yelp has deeper restaurant and nightlife reviews; Google has broader coverage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redundancy:&lt;/strong&gt; If one source lacks data for a location, another might have it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Different perspectives:&lt;/strong&gt; Yelp users and Google users rate businesses differently. By combining both it gives a fuller picture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Market-specific coverage:&lt;/strong&gt; Bing Maps may have better data in certain regions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, when building a neighborhood quality score, you could combine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Maps Reviews:&lt;/strong&gt; General local business sentiment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Yelp Reviews:&lt;/strong&gt; Detailed restaurant and nightlife ratings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This gives your users a more complete picture than relying on a single source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start Building Smarter Listings Today
&lt;/h3&gt;

&lt;p&gt;The gap between a platform users trust and one they abandon isn't the number of listings; it's the context around them. Every day your platform runs without automated location intelligence, you're leaving users to do the research you should be doing for them.&lt;/p&gt;

&lt;p&gt;The good news? You don't need a team of researchers or a complex data infrastructure to fix it. With the right API stack, you can enrich every listing automatically at scale.&lt;/p&gt;

&lt;p&gt;SerpApi gives you structured location data from multiple resources with a simple API call. Prevent user bounce today by giving your listings the context that closes decisions.&lt;/p&gt;

&lt;p&gt;If you have any question, contact us at &lt;a href="mailto:contact@serpapi.com"&gt;contact@serpapi.com&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connecting Web Search to Claude Desktop with SerpApi MCP</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Mon, 22 Jun 2026 13:20:48 +0000</pubDate>
      <link>https://dev.to/serpapi/connecting-web-search-to-claude-desktop-with-serpapi-mcp-4p3e</link>
      <guid>https://dev.to/serpapi/connecting-web-search-to-claude-desktop-with-serpapi-mcp-4p3e</guid>
      <description>&lt;p&gt;Connecting SerpApi web search to Claude Desktop gives Claude a live, structured feed of SERP data, including organic ranking positions, People Also Ask, local pack results, Google News, YouTube, Shopping, and more than 100 search engines, all queries from your chat window. And you can set it up without writing a single line of code.&lt;/p&gt;

&lt;p&gt;This guide walks through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What SerpApi MCP actually gives you that Claude's built-in web search doesn't, and why that matters for marketing work.&lt;/li&gt;
&lt;li&gt;A step-by-step setup tutorial. If you can copy and paste a URL, you can finish it in under five.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why should you connect SerpApi if LLMs already search the web?
&lt;/h2&gt;

&lt;p&gt;This is the fair first question, and worth answering before you spend five minutes setting anything up.&lt;/p&gt;

&lt;p&gt;Claude does have a built-in web search. When you ask it to "look up the best CRMs for small businesses" it will read a few pages and summarize them for you. That's useful for casual research, but there's a difference between browsing the web and using the actual search engines behind it. Claude's built-in search gives you a synthesized answer while SerpApi gives you the structured results page itself, in whichever Google product (or other engine) your question actually lives.&lt;/p&gt;

&lt;p&gt;The gap shows up the moment you step beyond plain Google Search. We tested Claude's built-in search against the same queries, and the limits become obvious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Search.&lt;/strong&gt; Even on plain web results, Claude's built-in search summarizes pages. It doesn't show you who ranks #1 through #10, what's in the People Also Ask box, which competitor owns the featured snippet, or how the SERP looks differently in Austin vs. London. SerpApi returns those positions and SERP features as structured data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Flights.&lt;/strong&gt; Ask Claude's built-in search for "cheapest flights from New York to Tokyo next month" and you'll get a recap of articles about flight prices not actual fare data, dates, airlines, or layovers. SerpApi's &lt;code&gt;google_flights&lt;/code&gt; engine returns the structured fare results directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Images.&lt;/strong&gt;"What does the new product packaging from [competitor] look like?" through built-in search reads pages but can't reliably surface the image grid itself. SerpApi's &lt;code&gt;google_images&lt;/code&gt; engine returns the image SERP as data, with source URLs and dimensions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Shopping.&lt;/strong&gt; Built-in search summarizes review articles; it doesn't return the product carousel with real prices, sellers, ratings, and product IDs. For competitive product research, that's a meaningful gap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google News.&lt;/strong&gt; Built-in search may pull a few recent headlines, but it doesn't give you the structured news SERP; publishers, exact timestamps, story clusters, which is what brand monitoring actually needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Local / Maps.&lt;/strong&gt;"Top dentists near me" through the built-in search reads aggregator pages. It can't simulate the local pack from a specific city the way SerpApi can with location parameters, which makes multi-city local SEO checks effectively impossible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvdhd31vif1l3cvfvzr5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvdhd31vif1l3cvfvzr5g.png" alt="Comparison Claude answer without SerpApi MCP (left) and with SerpApi MCP (right)" width="799" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Comparison Claude answer without SerpApi MCP (left) and with SerpApi MCP (right)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude's web search&lt;/strong&gt; tells you what the web says about a topic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SerpApi MCP&lt;/strong&gt; gives you direct, structured access to the search engines such as Google Search, Flights, Images, Shopping, News, Local, plus YouTube, Bing, and dozens of others.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For drafting, brainstorming, and general background research, Claude's built-in search is fine. For anything where the structure of the search results is the actual deliverable. SEO audits, content briefs based on top-ranking pages, competitive position tracking, local SEO checks across multiple cities, brand monitoring on Google News, flight or product price research, image and video research, you need real SERP data, and that's what SerpApi provides.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You'll Be Able to Do After This Setup
&lt;/h2&gt;

&lt;p&gt;Once SerpApi MCP is connected, you can ask Claude things that require a real-time SERP structure. Not just web reading:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Pull the top 10 organic results for 'project management software' in the US, then group competitors by the angle they use in their meta descriptions and title tags."&lt;/li&gt;
&lt;li&gt;"Check Google News for mentions of [our brand] in the last 7 days and show me the publishers, headlines, and dates."&lt;/li&gt;
&lt;li&gt;"Look up the top 5 YouTube videos for 'SEO for SaaS': give me titles, channels, view counts, and upload dates."&lt;/li&gt;
&lt;li&gt;"Pull every People Also Ask question for 'email marketing automation' plus the related searches at the bottom of the page, and turn them into a content brief."&lt;/li&gt;
&lt;li&gt;"Show me the local pack results for 'dentist near me' simulated from three different cities, and tell me which businesses appear in all three."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these is a real marketing task that Claude's built-in web search can't reliably handle because it depends on the structure of the SERP, not just the content of the pages it links to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-step setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites (Two Things, Both Free to Start)
&lt;/h3&gt;

&lt;p&gt;Before we open Claude, make sure you have these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Claude Desktop is installed&lt;/strong&gt; on Mac or Windows. Download it from &lt;a href="https://claude.com/download" rel="noopener noreferrer"&gt;claude.ai/download&lt;/a&gt; if you haven't already.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A SerpApi account&lt;/strong&gt;. A free account gives you 205 searches per month, which is plenty to test the workflow. You can &lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;sign up at serpapi.com&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. You will not be installing Node.js, Python, or any package manager. We're using SerpApi's hosted MCP server, so SerpApi runs the infrastructure for you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;A quick note on what MCP actually is:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The Model Context Protocol is an open standard that lets AI apps like Claude talk to external tools (search engines, CRMs, databases) without custom-built integrations. If you want a deeper explanation, we wrote a primer here: &lt;a href="https://serpapi.com/blog/model-context-protocol-mcp-a-unified-standard-for-ai-agents-and-tools/" rel="noopener noreferrer"&gt;Model Context Protocol (MCP): A Unified Standard for AI Agents and Tools&lt;/a&gt;. For this tutorial, you can treat MCP as "the universal adapter that lets Claude use SerpApi."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 1: Grab Your SerpApi API Key
&lt;/h3&gt;

&lt;p&gt;Once you're logged into SerpApi, go to your dashboard at &lt;a href="https://serpapi.com/manage-api-key" rel="noopener noreferrer"&gt;serpapi.com/manage-api-key&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You'll see a long string labeled "Your Private API Key." Click the copy icon next to it and paste it somewhere safe for a moment; you'll need it in Step 3. Treat this key like a password; don't share it publicly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffhdtfobhgbsgvtlsdr61.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffhdtfobhgbsgvtlsdr61.png" alt="SerpApi manage API key dashboard" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SerpApi manage API key dashboard&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Open the Connectors Screen in Claude Desktop
&lt;/h3&gt;

&lt;p&gt;Launch Claude Desktop. Then:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the left sidebar, click &lt;strong&gt;Customize&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Then, click &lt;strong&gt;Connectors&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You'll see a list of pre-built connectors (Gmail, Google Calendar, Google Drive, etc.) at the top, and at the bottom of the page there's a button that reads &lt;strong&gt;Add custom connector&lt;/strong&gt;. That's the one we want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fknav5ilgk7w8u5lpl1vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fknav5ilgk7w8u5lpl1vb.png" alt="Claude Desktop showing the Connectors tab and Add custom connector button" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Claude Desktop showing the Connectors tab and Add custom connector button&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't see the "Add custom connector" button?&lt;/strong&gt; Make sure Claude Desktop is fully updated. Custom connectors via remote MCP are available on free, Pro, Max, Team, and Enterprise plans, but older builds of the app may not show the button. Quit Claude Desktop completely and reopen it after updating.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 3: Add SerpApi as a Custom Connector
&lt;/h3&gt;

&lt;p&gt;Click &lt;strong&gt;Add custom connector&lt;/strong&gt;. A small dialog will pop up asking for two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; type &lt;code&gt;SerpApi&lt;/code&gt; (This is just the label you'll see in Claude; you can call it whatever you want)&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Remote MCP server URL:&lt;/strong&gt; paste this exact URL, replacing the placeholder with the API key you copied in Step 1:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mcp.serpapi.com/YOUR_SERPAPI_API_KEY/mcp" rel="noopener noreferrer"&gt;https://mcp.serpapi.com/YOUR_SERPAPI_API_KEY/mcp&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if your API key were &lt;code&gt;abc123xyz&lt;/code&gt;, the full URL would be:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.serpapi.com/abc123xyz/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Click &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbzu2xmbwqa2diqdb5cq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbzu2xmbwqa2diqdb5cq8.png" alt="Add custom connector dialog in Claude Desktop with SerpApi configuration filled in" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Add custom connector dialog in Claude Desktop with SerpApi configuration filled in&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;That's it. You don't need to edit any JSON files, run any terminal commands, or restart your computer. Claude will register the new connector immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Verify the Connection
&lt;/h3&gt;

&lt;p&gt;Back on the Connectors page, you should now see "SerpApi" in your list of connectors. Open a new Claude conversation and look for the tools/attachments icon ("+" near the message box) — SerpApi should appear in the list of available tools you can enable for the chat.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc7n9hu5bsxpa1xq2t89t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc7n9hu5bsxpa1xq2t89t.png" alt="SerpApi connectors in Claude Desktop" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SerpApi connectors in Claude Desktop&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To test it, send Claude a simple prompt like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Use SerpApi to search Google for 'best running shoes 2026' and give me the top 5 organic results with titles and URLs."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If everything's wired up correctly, Claude will tell you it's calling the SerpApi tool, then return real, current SERP data, not a 2025 cached guess.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft29kyveya5xzq1lsu8yh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft29kyveya5xzq1lsu8yh.png" alt="Claude Desktop returning live Google search results via SerpApi MCP" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Claude Desktop returning live Google search results via SerpApi MCP&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can compare the result on Claude Desktop by checking your search history on &lt;a href="https://serpapi.com/searches" rel="noopener noreferrer"&gt;serpapi.com/searches&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flr4gmkwoy53lkv3rr0rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flr4gmkwoy53lkv3rr0rk.png" alt="Your Search on SerpApi" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Your Search on SerpApi&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Five Ways Marketers Are Already Using This Setup
&lt;/h2&gt;

&lt;p&gt;To save you the "okay, now what?" moment, here are five workflows that have been getting traction. We covered these in more depth in our post on &lt;a href="https://serpapi.com/blog/top-5-practical-use-cases-for-serpapi-mcp-server-in-ai-agents/" rel="noopener noreferrer"&gt;the top 5 practical use cases for SerpApi MCP server in AI agents&lt;/a&gt;, but here's the short version tailored for marketing teams:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Real-time SERP audits.&lt;/strong&gt; Ask Claude to pull the top 10 results for a target keyword and analyze title patterns, schema markup hints, and what the competition is doing in featured snippets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content brief generation.&lt;/strong&gt; Have Claude pull People Also Ask questions, related searches, and the top 5 ranking pages for a keyword, then draft an outline that covers all of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Brand monitoring.&lt;/strong&gt; Run a Google News query for your brand or a competitor weekly, and let Claude summarize coverage, sentiment, and emerging narratives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local SEO checks.&lt;/strong&gt; Use Google Local results to see how your business ranks in the map pack across different cities — useful for multi-location brands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ad copy and creative research.&lt;/strong&gt; Pull Google Shopping or Google Ads-style results to see how competitors describe similar products, then iterate on your own positioning.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Power-User Tip: Get Better Tool Calls With Engine Schemas
&lt;/h2&gt;

&lt;p&gt;SerpApi recently added a feature where the MCP server exposes the full parameter list (called "engine schemas") for each search engine, such as Google, Bing, YouTube, etcm directly to Claude. That means Claude can pick the right parameters automatically (e.g., specifying &lt;code&gt;gl=us&lt;/code&gt; for US results, or &lt;code&gt;tbm=nws&lt;/code&gt; for news) without you having to know SerpApi's syntax.&lt;/p&gt;

&lt;p&gt;If you're curious how this works under the hood and how to nudge Claude toward higher-quality tool calls, we explained the mechanics in &lt;a href="https://serpapi.com/blog/how-to-use-serpapi-engine-schemas-in-serpapi-mcp-to-improve-tool-call-quality/" rel="noopener noreferrer"&gt;How to use SerpApi engine schemas in SerpApi MCP to improve tool call quality&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting: When Things Don't Work the First Time
&lt;/h2&gt;

&lt;p&gt;A few common gotchas:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Connector failed to connect" error.&lt;/strong&gt; Double-check that you pasted your API key into the URL correctly and that there are no spaces. The URL must be in the exact format &lt;code&gt;https://mcp.serpapi.com/YOUR_KEY/mcp&lt;/code&gt; — note the &lt;code&gt;/mcp&lt;/code&gt; at the end.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Claude says it doesn't have access to SerpApi.&lt;/strong&gt; In a new chat, you may need to enable the connector explicitly using the tools/attachment menu before Claude will use it. Some marketers also find it helps to mention "SerpApi" by name in the prompt for the first few queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You're hitting your search limit too quickly.&lt;/strong&gt; The free tier covers 100 searches per month. If you're testing aggressively or running this for a small team, the &lt;a href="https://serpapi.com/pricing" rel="noopener noreferrer"&gt;paid plans&lt;/a&gt; start at a low price and unlock thousands of searches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The connector worked, but the answers seem stale.&lt;/strong&gt; Make sure Claude is actually calling the tool. In the chat, you'll usually see an indicator showing the tool was invoked. If Claude is just answering from memory, prompt it more directly: "Use the SerpApi tool to search Google right now for…"&lt;/p&gt;

&lt;h2&gt;
  
  
  Going Beyond the Desktop App
&lt;/h2&gt;

&lt;p&gt;The setup we just walked through is the no-code path. If you (or someone on your team) eventually wants to embed this kind of live-search capability into a custom AI workflow, for example, an agent that does daily competitor monitoring and posts to Slack, the same SerpApi MCP works inside developer environments too. We have walkthroughs for two of those:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://serpapi.com/blog/integrating-serpapi-mcp-into-your-developer-workflow/" rel="noopener noreferrer"&gt;Integrating SerpApi MCP into Your Developer Workflow&lt;/a&gt;: covers Cursor, Claude Code, and other AI-assisted IDEs.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://serpapi.com/blog/build-an-ai-agent-with-claude-agent-sdk/" rel="noopener noreferrer"&gt;Build an AI Agent with the Claude Agent SDK&lt;/a&gt;: for when you're ready to build something programmatic on top of Claude.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the bigger picture of how the MCP server fits into SerpApi's product, the &lt;a href="https://serpapi.com/blog/introducing-serpapis-mcp-server/" rel="noopener noreferrer"&gt;original launch announcement&lt;/a&gt; is still the best one-page summary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Connecting SerpApi MCP to Claude Desktop is one of the lowest-effort, highest-leverage moves a non-technical marketer can make right now. Five minutes of setup buys you live access to Google, Bing, YouTube, and dozens of other engines from inside the same chat window where you're already drafting briefs, brainstorming campaigns, and analyzing competitors.&lt;/p&gt;

&lt;p&gt;Once it's wired up, the limit is your prompts, not your tooling.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Scrape Google Autocomplete Results (2026)</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Fri, 19 Jun 2026 13:51:20 +0000</pubDate>
      <link>https://dev.to/serpapi/how-to-scrape-google-autocomplete-results-2026-1il5</link>
      <guid>https://dev.to/serpapi/how-to-scrape-google-autocomplete-results-2026-1il5</guid>
      <description>&lt;p&gt;When you start typing the keyword search on Google, Google will suggest relevant keywords. There are several reasons, primarily related to research, analysis, SEO, and reputation optimization, to scrape Google Autocomplete results.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-us.googleusercontent.com%2FImSF75eiDLcCpt-PEtYCRJ2tH-9ObZQKgKsjzQfZN7MiSbrRCe9rCqD5-oigjsHiDsOOM3aDWbVGh4uRsJ49dl5S2tJCDtpXp2twxr-5sDInEZLT1D11qWm5ecoHWxGT9eNDZc5X6vkZTcnS2n3pJxU" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-us.googleusercontent.com%2FImSF75eiDLcCpt-PEtYCRJ2tH-9ObZQKgKsjzQfZN7MiSbrRCe9rCqD5-oigjsHiDsOOM3aDWbVGh4uRsJ49dl5S2tJCDtpXp2twxr-5sDInEZLT1D11qWm5ecoHWxGT9eNDZc5X6vkZTcnS2n3pJxU" alt="Google Autocomplete search" width="973" height="970"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Google Autocomplete search&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do you need to scrape the autocomplete suggestions?
&lt;/h2&gt;

&lt;p&gt;By scraping Google Autocomplete keywords, you can discover popular search queries related to specific keywords or topics, and generate ideas for your blog posts, videos, etc. You can have more insights into trending topics, frequently asked questions, and more!&lt;/p&gt;

&lt;p&gt;Google Autocomplete keywords are also an excellent source for tracking mentions, sentiments, and brand reputation. For local businesses, they will help to understand the search behavior of users in specific locations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution to scrape Google Autocomplete
&lt;/h2&gt;

&lt;p&gt;If you want to scrape real-time keyword suggestions in different locations and different languages, SerpApi Google Autocomplete offers high-quality APIs to support your success.&lt;/p&gt;

&lt;p&gt;Here's what sets it apart:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Structured JSON output: Results are returned in clean, ready-to-use JSON format, so you can immediately pipe data into your app, dashboard, or content tool without any parsing headaches&lt;/li&gt;
&lt;li&gt;Real-time data: Always reflects the latest autocomplete suggestions as they appear on Google&lt;/li&gt;
&lt;li&gt;Location &amp;amp; language targeting: Easily specify country, city, and language parameters in a single API call&lt;/li&gt;
&lt;li&gt;No maintenance required: SerpApi handles all proxy rotation, CAPTCHA solving, and Google updates on their end&lt;/li&gt;
&lt;li&gt;Reliable uptime: No scraper breakdowns or data gaps interrupting your workflow&lt;/li&gt;
&lt;li&gt;Simple integration: Works with any language or framework via straightforward REST API calls&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's do some searches on our &lt;a href="https://serpapi.com/playground?engine=google_autocomplete" rel="noopener noreferrer"&gt;playground&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-us.googleusercontent.com%2FtHfypQpOeDeM9icaT3ZOniQZChyiv9nK-Ce9eDHHzm2Upu9jzUt5GleiregPKb_z4gutf31rSJDUE0JHZ5YZMhFNSAUQm1mydIri28KLFaSWGkuiXE9-nIRDe0g3TQkGGP72hNK5Y1Kp6wJs4fXgMzo" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flh7-us.googleusercontent.com%2FtHfypQpOeDeM9icaT3ZOniQZChyiv9nK-Ce9eDHHzm2Upu9jzUt5GleiregPKb_z4gutf31rSJDUE0JHZ5YZMhFNSAUQm1mydIri28KLFaSWGkuiXE9-nIRDe0g3TQkGGP72hNK5Y1Kp6wJs4fXgMzo" alt="Google Autocomplete API playground" width="1408" height="1038"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Google Autocomplete API playground&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here is a video tutorial in Python:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/embed/7iP7caHdH6A?feature=oembed" rel="noopener noreferrer"&gt;https://www.youtube.com/embed/7iP7caHdH6A?feature=oembed&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Setting up a SerpApi account
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;SerpApi&lt;/a&gt; offers a free plan for newly created accounts. Head to the &lt;a href="https://serpapi.com/users/sign_up?plan=free" rel="noopener noreferrer"&gt;sign-up&lt;/a&gt; page to register an account and complete your first search with our &lt;a href="https://serpapi.com/playground?engine=google_autocomplete" rel="noopener noreferrer"&gt;interactive playground&lt;/a&gt;. When you want to do more searches with us, please visit the &lt;a href="https://serpapi.com/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you are familiar with all the results, you can use the SERP APIs with your &lt;a href="https://serpapi.com/manage-api-key" rel="noopener noreferrer"&gt;API Key&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgzvbwz8o4yf7m7hq7v07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgzvbwz8o4yf7m7hq7v07.png" alt="Google Autocomplete API documentation" width="800" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Google Autocomplete API documentation&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scrape your first Google Autocomplete results with SerpApi
&lt;/h3&gt;

&lt;p&gt;Head to the Google Autocomplete Results from the &lt;a href="https://serpapi.com/google-autocomplete-api" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; on &lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;SerpApi&lt;/a&gt; for details.&lt;/p&gt;

&lt;p&gt;In this tutorial, we will scrape keyword suggestions when searching with the "star" keyword. Will Google suggest "Starbucks" or "Star Wars"...? The data contains: "value", "relevance", "type", and more. You can also scrape more information with SerpApi.&lt;/p&gt;

&lt;p&gt;First, you need to install the &lt;a href="https://github.com/serpapi/serpapi-python" rel="noopener noreferrer"&gt;SerpApi client library&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;serpapi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up the&lt;a href="https://serpapi.com/?ref=serpapi.com" rel="noopener noreferrer"&gt;SerpApi&lt;/a&gt;&lt;a href="https://serpapi.com/manage-api-key?ref=serpapi.com" rel="noopener noreferrer"&gt;credentials&lt;/a&gt; and search.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;serpapi&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;

&lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;YOUR_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# your serpapi api
&lt;/span&gt;    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;engine&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;google_autocomplete&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# SerpApi search engine    
&lt;/span&gt;    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;star&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To retrieve Google Autocomplete Results for a given search query, you can use the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;serpapi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;suggestions&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can store Google Autocomplete Results JSON data in databases or export it to a CSV file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;

&lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;value&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relevance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;google_autocomplete.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;UTF8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;writer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerow&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;value&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relevance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;type&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48292mrfbg0z5846qwyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48292mrfbg0z5846qwyy.png" width="375" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This example uses Python, but you can also use your favorite programming languages, such as Ruby, Node.js, Java, PHP, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced Parameters
&lt;/h3&gt;

&lt;p&gt;Let’s take a look at the Advanced Parameters, as we have gone over the &lt;code&gt;localization&lt;/code&gt; before in other blogs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/serpapi/geographic-location-and-localization-parameters-on-serpapis-google-search-efbedaa8a4dd" rel="noopener noreferrer"&gt;Geographic Location and Localization parameters on SerpApi’s Google Search API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the advanced parameters we have:&lt;code&gt;cp&lt;/code&gt; and &lt;code&gt;client&lt;/code&gt; for potential parameters.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqssx18pg7fyk4tkcl42y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqssx18pg7fyk4tkcl42y.png" width="560" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you hover over the &lt;code&gt;?&lt;/code&gt; near the parameter names, we see the breakdown.&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;cp&lt;/code&gt; it states:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Cursor pointer defines the position of cursor for the query provided, position starts from 0 which is a case where cursor is placed before the query &lt;code&gt;|query&lt;/code&gt;. If not provided acts as cursor is placed in the end of query &lt;code&gt;query|&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For &lt;code&gt;client&lt;/code&gt; it states:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Parameter used to define client for autocomplete. List of supported&lt;/em&gt; &lt;a href="https://serpapi.com/google-autocomplete-clients" rel="noopener noreferrer"&gt;&lt;em&gt;clients&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And this link brings us to the SerpApi page of Supported Google Autocomplete Clients:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5z101nny66kb0mqzarj2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5z101nny66kb0mqzarj2.png" width="799" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this is an option for the type of browser that would be queried with.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;psy-ab&lt;/code&gt; is used in when google is opened in google chrome.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;safari&lt;/code&gt; is used in when google is opened in safari.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;firefox&lt;/code&gt; is used in when google is opened in firefox.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;youtube&lt;/code&gt; origin unknown. Returns JSONP.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;toolbar&lt;/code&gt; origin unknown. Returns XML.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Use Case
&lt;/h2&gt;

&lt;p&gt;Now I went over to the SerpApi &lt;a href="http://www.serpapi.com/playground" rel="noopener noreferrer"&gt;Playground&lt;/a&gt; and started playing with the white-listed query “coffee” and manipulating the advanced search parameters.&lt;/p&gt;

&lt;p&gt;First I wanted to see if there was a significant difference in dataset (I copied only the first 5 results) when I changed the cursor pointer &lt;code&gt;cp&lt;/code&gt; parameter from &lt;em&gt;&lt;code&gt;|query&lt;/code&gt;&lt;/em&gt; to &lt;em&gt;&lt;code&gt;query|&lt;/code&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee near me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;950&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee washington"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;601&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee alexandria va"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee shops near me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;554&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee table"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;553&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;VS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee mate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;601&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee break"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee bread"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;555&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee bar"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;554&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee prince"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;553&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is a different response. And also within the dataset there is a “relevance” data set.&lt;/p&gt;

&lt;p&gt;I wondered where and what the information correlated to. When I checked out the &lt;code&gt;raw_html_file&lt;/code&gt; I saw this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc91r16g2jzbbjcanf3kj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc91r16g2jzbbjcanf3kj.png" width="800" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a relevance score that is a bit arbitrary to users, but this is how Google ranks and orders the results.Then when switching the &lt;code&gt;client&lt;/code&gt; . Here are the top three JSON results.&lt;/p&gt;

&lt;p&gt;Chrome:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee near me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee las vegas"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;601&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee henderson nv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Chrome-omni:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffeeholic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;651&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee near me"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;650&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee bellevue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"relevance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;601&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"QUERY"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Safari:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee nearby"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee near me"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee richmond va"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FireFox:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffeeshop"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffeeshop in de buurt"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffeelicious"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Psy-ab:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee&amp;lt;b&amp;gt; near me&amp;lt;/b&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee&amp;lt;b&amp;gt; shops near me&amp;lt;/b&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Youtube:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee near me"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee columbus ohio"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"coffee dublin ohio"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Quite different results and also, the relevancy score was only prevalent in chrome and chrome-omni searches.&lt;/p&gt;

&lt;p&gt;If you have any questions, please feel free to &lt;a href="mailto:contact@serpapi.com"&gt;contact us&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/google-autocomplete-api" rel="noopener noreferrer"&gt;Google Autocomplete API documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/playground?engine=google_autocomplete" rel="noopener noreferrer"&gt;Google Autocomplete API playground&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Further reading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Expand what you can do with Google Autocomplete by combining it with other powerful data sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/blog/google-seo-keywords-generator-tool-nodejs/" rel="noopener noreferrer"&gt;JavaScript SEO Keywords Research Tool: Google Autocomplete, People Also Ask, and People Also Search For&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://serpapi.com/blog/python-seo-keyword-research-tool/" rel="noopener noreferrer"&gt;Python SEO Keyword Research Tool: Google Autocomplete, People Also Ask and Related Searches&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Build an AI Overview Rank Tracker using Python</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Wed, 04 Feb 2026 01:46:22 +0000</pubDate>
      <link>https://dev.to/serpapi/build-an-ai-overview-rank-tracker-using-python-1kg3</link>
      <guid>https://dev.to/serpapi/build-an-ai-overview-rank-tracker-using-python-1kg3</guid>
      <description>&lt;p&gt;Search engines are evolving rapidly. Instead of presenting only a list of websites, Google now frequently displays AI Overviews. It is an AI-generated summary that combines information from multiple sources and presents answers directly at the top of the search results page.&lt;/p&gt;

&lt;p&gt;As a result, visibility is no longer defined solely by rankings. This shift has introduced a new concept known as Generative Engine Optimization (GEO).&lt;/p&gt;

&lt;p&gt;In this tutorial, we'll walk through how to build a simple AI Overview Rank Tracker using Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is an AI Overview Rank Tracker?
&lt;/h2&gt;

&lt;p&gt;An AI Overview Rank Tracker is a tool that answers a new kind of visibility question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Is my website cited inside Google's AI Overview, and how prominent is that citation?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Traditional rank trackers focus on organic positions (1–10).&lt;br&gt;&lt;br&gt;
An AI Overview Rank Tracker focuses on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether an AI Overview appears for a query&lt;/li&gt;
&lt;li&gt;Which sources does the AI references&lt;/li&gt;
&lt;li&gt;The order in which those sources appear&lt;/li&gt;
&lt;li&gt;Whether your brand or competitors are included&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a core component of Generative Engine Optimization (GEO).&lt;/p&gt;
&lt;h2&gt;
  
  
  Why AI Overviews Change How Ranking Works
&lt;/h2&gt;

&lt;p&gt;AI Overviews often appear above organic results and summarize information directly on the search results page. In many cases, users get their answers without clicking any links.&lt;/p&gt;

&lt;p&gt;This introduces several challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Traditional rankings become less visible&lt;/li&gt;
&lt;li&gt;Click-through rates are harder to attribute&lt;/li&gt;
&lt;li&gt;Competition shifts toward citations, not just rankings&lt;/li&gt;
&lt;li&gt;Existing SEO tools offer little insight into AI-generated answers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As AI Overviews become more common, tracking AI citation presence becomes essential.&lt;/p&gt;

&lt;p&gt;Read more details explanation about Rank Tracking in the Age of AI Overviews from our previous post below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://serpapi.com/blog/rank-tracking-in-the-age-of-ai-overviews-whats-changed/" rel="noopener noreferrer"&gt;Rank Tracking in the Age of AI Overviews: What's Changed&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Traditional Scraping Is Not Enough
&lt;/h2&gt;

&lt;p&gt;Tracking AI Overviews via browser automation or raw HTML scraping is unreliable due to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript-rendered content&lt;/li&gt;
&lt;li&gt;Frequent layout changes&lt;/li&gt;
&lt;li&gt;Regional and language variations&lt;/li&gt;
&lt;li&gt;Bot detection and captchas&lt;/li&gt;
&lt;li&gt;Fragile DOM-based selectors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These issues make traditional scraping brittle and difficult to maintain at scale.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using SerpApi to Build an AI Overview Rank Tracker
&lt;/h2&gt;

&lt;p&gt;SerpApi provides real-time access to structured search engine data, including AI-generated elements where available. It handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP rotation and request routing&lt;/li&gt;
&lt;li&gt;JavaScript rendering&lt;/li&gt;
&lt;li&gt;Layout changes across regions&lt;/li&gt;
&lt;li&gt;High-volume request reliability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By using a &lt;a href="https://serpapi.com/" rel="noopener noreferrer"&gt;Web Search API&lt;/a&gt;, developers can focus on analysis and insights rather than infrastructure maintenance.&lt;/p&gt;

&lt;p&gt;Check out the tutorial below on how to get results from AI Overviews using our API:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://serpapi.com/blog/scrape-google-ai-overviews/" rel="noopener noreferrer"&gt;How to Scrape Google AI Overviews (AIO)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Prefer watching instead of reading? You can also follow along with the video walkthrough below:&lt;br&gt;
  &lt;iframe src="https://www.youtube.com/embed/Ta58WTvA5qg"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Building an AI Overview Rank Tracker using Python
&lt;/h2&gt;

&lt;p&gt;Below is a step-by-step implementation that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detects AI Overviews&lt;/li&gt;
&lt;li&gt;Fetches AI Overview details&lt;/li&gt;
&lt;li&gt;Extracts cited sources&lt;/li&gt;
&lt;li&gt;Prints title and link only&lt;/li&gt;
&lt;li&gt;Determines whether a specific website is cited&lt;/li&gt;
&lt;li&gt;Reports the site’s rank inside the AI Overview&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0nxh1691g816ph28u3e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0nxh1691g816ph28u3e.gif" alt="AI overview Rank Tracker in terminal" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Install dependencies
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install google-search-results python-dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Run a Google search and detect AI Overview presence
&lt;/h3&gt;

&lt;p&gt;AI Overview does not appear for every query.&lt;/p&gt;

&lt;p&gt;The first step is to detect whether one exists and retrieve its &lt;code&gt;page_token&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from serpapi import GoogleSearch
import os

SERPAPI_API_KEY = os.getenv("SERPAPI_API_KEY")

def detect_ai_overview(query):
    params = {
        "engine": "google",
        "q": query,
        "hl": "en",
        "gl": "us",
        "api_key": SERPAPI_API_KEY
    }

    search = GoogleSearch(params)
    results = search.get_dict()

    ai_overview = results.get("ai_overview")
    if not ai_overview:
        return None

    return ai_overview.get("page_token")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;query&lt;/code&gt; here refers to target keyword or search phrase you want to monitor for AI Overview visibility.&lt;/p&gt;

&lt;p&gt;If no &lt;code&gt;page_token&lt;/code&gt; is returned, the query does not trigger an AI Overview.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Fetch the AI Overview result page
&lt;/h3&gt;

&lt;p&gt;Once a page token is available, use the &lt;code&gt;google_ai_overview&lt;/code&gt; engine to retrieve full AI Overview data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fetch_ai_overview(page_token):
    params = {
        "engine": "google_ai_overview",
        "page_token": page_token,
        "api_key": SERPAPI_API_KEY
    }

    search = GoogleSearch(params)
    return search.get_dict()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This response includes structured AI content and cited references.&lt;/p&gt;

&lt;p&gt;Note: Since this is another API endpoint, it uses another one search credit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Extract citations and calculate rank
&lt;/h3&gt;

&lt;p&gt;In AI Overviews, ranking is determined by the order in which references are returned by the API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from urllib.parse import urlparse

def normalize_domain(url):
    return urlparse(url).netloc.replace("www.", "")

def analyze_ai_overview(ai_results, target_url):
    references = ai_results.get("ai_overview", {}).get("references", [])
    target_domain = normalize_domain(target_url)

    found_rank = None

    print("\nAI Overview References:\n")

    for rank, ref in enumerate(references, start=1):
        title = ref.get("title")
        link = ref.get("link")

        print(f"{rank}. {title}")
        print(f"   {link}\n")

        if target_domain in normalize_domain(link):
            found_rank = rank

    if found_rank:
        print(f"Your site appears in the AI Overview at position #{found_rank}")
    else:
        print("Your site is not referenced in the AI Overview")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Run the full AI Overview Rank Tracker
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if __name__ == "__main__":
    query = input("Enter target keyword to track: ").strip()
    website = input("Enter your website URL: ").strip()

    page_token = detect_ai_overview(query)

    if not page_token:
        print("No AI Overview detected for this query.")
    else:
        ai_results = fetch_ai_overview(page_token)
        analyze_ai_overview(ai_results, website)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Result
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtzvavr33zuzvepriikv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtzvavr33zuzvepriikv.png" alt="AI Overview Rank Tracker result" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Full code is available in our GitHub &lt;a href="https://github.com/serpapi/tutorials/tree/master/python_projects/ai_overview_rank_tracker" rel="noopener noreferrer"&gt;serpapi/tutorials&lt;/a&gt; repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;AI Overviews are redefining search visibility. As generative search experiences continue to expand, being cited by AI systems becomes as important as ranking organically.&lt;/p&gt;

&lt;p&gt;An AI Overview Rank Tracker allows developers and SEO teams to measure this new form of visibility using structured, reliable data. By leveraging &lt;a href="https://serpapi.com/search-api" rel="noopener noreferrer"&gt;Google Search API&lt;/a&gt; and &lt;a href="https://serpapi.com/ai-overview" rel="noopener noreferrer"&gt;Google AI Overview API&lt;/a&gt;, we can move beyond fragile scraping and build scalable GEO monitoring systems for the future of search.&lt;/p&gt;

</description>
      <category>aioverviewapi</category>
      <category>websearchapi</category>
      <category>airanktracker</category>
      <category>python</category>
    </item>
    <item>
      <title>How AI Can Predict the Success of Your Business Using Data from Google Maps</title>
      <dc:creator>Noraina Nordin</dc:creator>
      <pubDate>Wed, 17 Sep 2025 10:59:22 +0000</pubDate>
      <link>https://dev.to/serpapi/how-ai-can-predict-the-success-of-your-business-using-data-from-google-maps-3821</link>
      <guid>https://dev.to/serpapi/how-ai-can-predict-the-success-of-your-business-using-data-from-google-maps-3821</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Coffee shops are booming in my area. Every month, I hear about a new one opening, which makes me wonder:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Will these business last long? Or are they just part of a seasonal hype?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This curiosity inspired me to create an AI agent that can explore the coffee shop market and predict its potential success. While I'm focusing on coffee shops in this project, the same framework can be applied to other businesses, such as restaurants, salons, gyms, and retail stores. However, because LLMs are limited by their knowledge cutoff dates, having access to real-time data is crucial for obtaining the most up-to-date insights.&lt;/p&gt;

&lt;p&gt;Traditionally, entrepreneurs relied on guesswork, small surveys, or costly market research. Now, thanks to tools like Google Maps and Google Reviews, we can access real-time information to guide better decisions.&lt;/p&gt;

&lt;p&gt;In this project, we will use these two API solutions from SerpApi to help us gather data easily:&lt;/p&gt;

&lt;p&gt;-&lt;a href="https://serpapi.com/google-maps-api" rel="noopener noreferrer"&gt;Google Maps API&lt;/a&gt;:  To scrape business listings and locations.&lt;br&gt;
-&lt;a href="https://serpapi.com/google-maps-reviews-api" rel="noopener noreferrer"&gt;Google Maps Reviews API&lt;/a&gt;: To extract detailed customer reviews and ratings.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://serpapi.com/blog/scrape-google-maps-data-and-reviews-using-python/" rel="noopener noreferrer"&gt;Scrape Google Maps data and reviews using Python&lt;/a&gt;, a comprehensive Getting Started Tutorial.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Please keep in mind that this AI agent is intended for educational purposes only. While it provides useful insights, predictions may not always be entirely accurate. To get the best results, it's a good idea to combine AI insights with your own careful market research.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How the AI Agent Works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Search for coffee shops using SerpApi's Google Maps API&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt; Input either a location (e.g., "Austin, TX") or GPS coordinates.&lt;/li&gt;
&lt;li&gt; Scrape all the local coffee shops with metadata.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Pull reviews with SerpApi's Google Maps Reviews API&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt; Extract customer opinions, ratings, and timestamps for each competitor.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;AI-Powered Analysis&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt; Summarize competitor density and pricing tiers.&lt;/li&gt;
&lt;li&gt; Perform sentiment analysis on customer reviews.&lt;/li&gt;
&lt;li&gt; Predict the success probability of a new coffee shop in the area.&lt;/li&gt;
&lt;li&gt; Output structured tables and an action plan in a clean Markdown file.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0qahxe0bl8govo3a1mi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0qahxe0bl8govo3a1mi.png" alt="AI workflow" width="799" height="234"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Using SerpApi to scrape data from Google Maps
&lt;/h2&gt;

&lt;p&gt;SerpApi's Google Maps API allows us to gather organized data from Google Maps quickly and easily, without the hassle of CAPTCHA, proxies, or manual scraping stress.&lt;/p&gt;

&lt;p&gt;With just one API request, you can access a wealth of information. Feel free to explore our &lt;a href="https://serpapi.com/playground?engine=google_maps" rel="noopener noreferrer"&gt;Google Maps API playground&lt;/a&gt; to see what data you can retrieve. Below, there's a sample screenshot from our playground to give you an idea.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3g3yptvsiw5yfbqxl1nl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3g3yptvsiw5yfbqxl1nl.png" alt="Google Maps API playground" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, this is the data we need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;title&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;data_id&lt;/code&gt; (We need this information to be able to retrieve the reviews later)&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;gps_coordinates&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;address&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;rating&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;reviews&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;price&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;operating_hours&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All data will be passed to the AI model for analysis, except for the &lt;code&gt;data_id&lt;/code&gt;, which is required to scrape Google Maps Reviews.&lt;/p&gt;

&lt;p&gt;Beyond ratings, reviews tell the real story. Using SerpApi's Google Maps Reviews API, we can pull recent customer feedback for each competitor. You can visit our &lt;a href="https://serpapi.com/playground?engine=google_maps_reviews" rel="noopener noreferrer"&gt;Google Maps Reviews API playground&lt;/a&gt; to explore the additional information we can collect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F65wq16kq5rh03nmvnwu6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F65wq16kq5rh03nmvnwu6.png" alt="Google Maps Reviews API playground" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The data that we're interested in collecting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;snippet&lt;/code&gt; which is the customer's review&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;rating&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;date&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Set up the scraper
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  Python 3.9+&lt;/li&gt;
&lt;li&gt;  Install dependencies:

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;pip install google-search-results openai python-dotenv requests&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;a href="https://serpapi.com/manage-api-key" rel="noopener noreferrer"&gt;SerpApi API keys&lt;/a&gt; (sign up &lt;a href="https://serpapi.com/users/sign_up" rel="noopener noreferrer"&gt;here&lt;/a&gt; to get 250 free searches/month).&lt;/li&gt;
&lt;li&gt;  OpenAI API key or download the &lt;a href="https://ollama.com/library/gpt-oss" rel="noopener noreferrer"&gt;gpt-oss&lt;/a&gt; model locally via &lt;a href="https://ollama.com/download" rel="noopener noreferrer"&gt;ollama&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;  Create a &lt;code&gt;.env&lt;/code&gt; file with your API keys.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SERPAPI_API_KEY=your_serpapi_key_here
OPENAI_API_KEY=your_openai_key_here # If you're using OpenAI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Import the necessary libraries
&lt;/h3&gt;

&lt;p&gt;Before we begin, let's import the necessary libraries for making API calls, logging, managing environment variables, and handling dates and times.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dotenv&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_dotenv&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;serpapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;GoogleSearch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For our convenience, we will create a log to record debug information. It will be saved in the &lt;code&gt;debug.log&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getLogger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coffee_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;file_handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FileHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;debug.log&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;file_handler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Formatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%(asctime)s %(levelname)s: %(message)s&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;datefmt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d %H:%M:%S&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file_handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;stream_handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;StreamHandler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;stream_handler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setFormatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Formatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%(asctime)s %(levelname)s: %(message)s&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;datefmt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d %H:%M:%S&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stream_handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Scrape data from Google Maps
&lt;/h3&gt;

&lt;p&gt;The first step is to query Google Maps for coffee shops around a given location or coordinates.&lt;/p&gt;

&lt;p&gt;We define a helper function to build the search parameters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Coffee Shop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_search_params&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;isdigit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;part&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Fetching &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; near coordinates: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;engine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google_maps&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ll&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;,14z&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Fetching &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; in location: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;engine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google_maps&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; in &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function builds the right parameters depending on whether the user types a city name or latitude/longitude coordinates.&lt;/p&gt;

&lt;p&gt;You can change the value for &lt;code&gt;BUSINESS_TYPE&lt;/code&gt; based on your business of interest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxif3jrinpwrv86z85k8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxif3jrinpwrv86z85k8l.png" alt="user input" width="800" height="39"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's use it to scrape nearby coffee shops:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_shops_details&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_params&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sending request to SerpApi for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; search...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://serpapi.com/search&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;search_params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Received response: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Received response from SerpAPI.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;local_results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;local_results&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Found &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;local_results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;s around the area.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;local_results&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This part of the script sends a request to SerpApi's Google Maps API to retrieve local business results based on the area specified by the user's input.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7om7hi8503bac3zkn4um.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7om7hi8503bac3zkn4um.png" alt="shops result" width="800" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visit our &lt;a href="https://serpapi.com/google-maps-api" rel="noopener noreferrer"&gt;Google Maps API documentation&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scrape data from Google Maps Reviews
&lt;/h3&gt;

&lt;p&gt;Each coffee shop result has a unique &lt;code&gt;data_id&lt;/code&gt;, which we get from the previous API call. We can use this &lt;code&gt;data_id&lt;/code&gt; to retrieve customer reviews.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fetch_reviews&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shop_title&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Fetching reviews for: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop_title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;review_params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api_key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SERPAPI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;engine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google_maps_reviews&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;data_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hl&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;review_search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;GoogleSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;review_params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;review_results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;review_search&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_dict&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;reviews&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;review_results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;reviews&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Found &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; reviews for shop &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop_title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;review_text&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;snippet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;review_star_rating&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rating&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timestamp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;date&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reviews&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script sends a request to SerpApi's Google Maps Reviews API to scrape each customer's reviews and returns the collected reviews to each coffee shop's data.&lt;/p&gt;

&lt;p&gt;In our example, 20 coffee shops were found in the area from the previous search, resulting in 20 requests for Google Maps Reviews. Check out your search history &lt;a href="https://serpapi.com/searches" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgykmf1geubgayk8wfs46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgykmf1geubgayk8wfs46.png" alt="example output" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visit our &lt;a href="https://serpapi.com/google-maps-reviews-api" rel="noopener noreferrer"&gt;Google Maps Reviews documentation&lt;/a&gt; for detailed information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build Competitor Dataset
&lt;/h3&gt;

&lt;p&gt;Finally, let's put everything together into a string format for the AI to analyze.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;format_competitor_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;competitors&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;competitor_data_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;shop&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;competitors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;competitor_data_str&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;- &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;business_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Address: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;address&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - GPS: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;GPS_coordinates&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Star Rating: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;star_rating&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Review Count: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;review_count&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Opening Hours: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;opening_hours&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Price Level: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;price_level&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  - Customer Reviews:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;review&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer_reviews&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="n"&gt;competitor_data_str&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;    - &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;review_text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt; | &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;review_star_rating&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; stars | &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;timestamp&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;competitor_data_str&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Set up an AI agent
&lt;/h2&gt;

&lt;p&gt;Now that we have the competitor data, let's build an AI agent to analyze it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Design the AI prompt
&lt;/h3&gt;

&lt;p&gt;LLMs perform best when provided with clear, structured instructions. Here's an example prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;build_prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;competitor_data_str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
                You are **&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; Success Forecaster**, an AI agent that predicts the potential success of a new &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; in a given location.

                You will be fed structured data about competitor &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;BUSINESS_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;s, including:
                &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;competitor_data_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;

                Your tasks are:

                1. **Market Landscape Analysis**
                - Summarize competitor density within 1–3 km.
                - Identify star-rating patterns, price tiers, and operating hours.
                - Highlight underserved niches (pricing gaps, late-night, early-morning).
                - Output:
                    - A **2-column table** with | Metric | Observations |.
                    - A short **bullet list of underserved slots/pricing gaps**.

                2. **Sentiment &amp;amp; Customer Insight**
                - Perform sentiment analysis on reviews.
                - Extract recurring positives, negatives, and unmet needs.
                - Output:

                    | Sentiment Category | Positive Highlights | Negative Highlights | Unmet Needs / Opportunities |
                    |--------------------|---------------------|---------------------|-----------------------------|

                - Conclude with exactly **3 key takeaways** in bullet points.

                3. **Success Prediction**
                - Estimate a **success probability score (0–100%)** in bold.
                - Output:
                    - A **2-column table** with | Metric | Value |.
                    - A bullet list of the **Top 3 drivers of success/failure**.

                4. **Recommendations**
                - Output:
                    - A **2-column table** with | Differentiator | Rationale |.
                    - A **2-column Risks &amp;amp; Mitigations table**.
                    - End with an **Action Plan** that:
                        - Is written as **one concise paragraph (1–2 sentences, max 3 lines)**.
                        - Starts with: **Action plan:** (exact text, bolded).
                        - Specifies **location, operating hours, pricing, or promotions** directly tied to the analysis.
                        - Avoids bullet points, timelines (“next 2 weeks”), or generic advice.

                ⚠️ Rules for consistency:
                - Always be clear, data-driven, and practical.
                - Do not give generic answers; tailor insights directly to the provided data.
                - Use tables where defined, and bullets only where instructed.
                - Keep tone business-strategic, concise, and data-driven.
                - Do not mix styles between sections.
            &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how we use tables, bullet points, and structured outputs to make things clearer and easier to follow. You can experiment with different prompts to see what works best for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run the AI Agent
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="nf"&gt;load_dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;api_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SERPAPI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter your business location name or coordinates (e.g., &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Austin, TX&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; or &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;30.2957009,-98.0626221&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;) [type &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; or &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;quit&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; to exit]: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;q&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;quit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Exiting program.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[ERROR] Input cannot be empty. Please enter a valid location name or coordinates.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;isinstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[ERROR] Input must be a string.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;

    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;
    &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%Y-%m-%d %H:%M:%S&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;search_params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_search_params&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;local_results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fetch_shops_details&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;competitors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_competitor_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;local_results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;competitor_data_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;format_competitor_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;competitors&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build_prompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;competitor_data_str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://localhost:11434/v1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# Local Ollama API
&lt;/span&gt;        &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ollama&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;                       &lt;span class="c1"&gt;# Dummy key
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-oss:20b&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ai_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;
    &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AI response: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ai_output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Save AI output to markdown file with timestamp
&lt;/span&gt;    &lt;span class="n"&gt;md_filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ai_response_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%Y%m%d_%H%M%S&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;md_filename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;encoding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;md_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;md_file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ai_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ai_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run this script, the AI will output a market analysis, sentiment breakdown, prediction, score, and action plan in Markdown format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzcnyx5mh0b7j72tq97hp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzcnyx5mh0b7j72tq97hp.png" alt="final result" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full source code is available in our &lt;a href="https://github.com/serpapi/tutorials/tree/master/python_projects/business-success-predictor" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;While this prototype focuses on coffee shops, the same approach could easily apply to other businesses as well, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Restaurants&lt;/li&gt;
&lt;li&gt;  Gym&lt;/li&gt;
&lt;li&gt;  Salons&lt;/li&gt;
&lt;li&gt;  Co-working spaces&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some possible improvements that you can make:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Add charts &amp;amp; visualizations (e.g., competitor density heatmaps)&lt;/li&gt;
&lt;li&gt;  Deploy as a Flask/FastAPI web app so anyone can test it in their city.&lt;/li&gt;
&lt;li&gt;  Turn into a dashboard tool for entrepreneurs scouting opportunities.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By combining real-time Google Maps data with AI analysis, we can quickly gain insights into competition, customer sentiment, and market gaps.&lt;/p&gt;

&lt;p&gt;Of course, no AI can perfectly predict business success. However, tools like this can provide entrepreneurs with a faster and more data-driven way to explore opportunities.&lt;/p&gt;

&lt;p&gt;⚠️ *&lt;strong&gt;&lt;em&gt;Disclaimer&lt;/em&gt;&lt;/strong&gt;*: This project is for educational and experimental purposes only. Predictions may be inaccurate. Always validate insights with proper market research before making real business decisions.&lt;/p&gt;

&lt;p&gt;Note:&lt;/p&gt;

&lt;p&gt;If you'd like to explore the &lt;strong&gt;Google Maps API&lt;/strong&gt; and &lt;strong&gt;Google Reviews API&lt;/strong&gt; for other use cases, be sure to check out our in-depth tutorial below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://serpapi.com/blog/how-to-make-a-travel-guide-using-serp-data-and-python/" rel="noopener noreferrer"&gt;How To Make a Travel Guide Using SERP data and Python&lt;/a&gt;&lt;br&gt;
&lt;a href="https://serpapi.com/blog/gauge-business-popularities-using-google-maps/" rel="noopener noreferrer"&gt;Gauge Business Popularities using Google Maps&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>ai</category>
      <category>startup</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
