import os import requests from dotenv import load_dotenv load_dotenv() # You found this CID in your previous Serper request (e.g., Veera 5) place_cid = "1433095058555445262" # Note: This uses SerpApi (serpapi.com), NOT Serper.dev url = "https://serpapi.com/search" api_key = os.getenv("SERPAPI_API_KEY") if not api_key: raise RuntimeError( "SERPAPI_API_KEY is missing. Set it in .env (local) or Hugging Face Secrets." ) params = { "engine": "google_maps_reviews", # This engine fetches the TEXT "data_id": f"0x0:0x{hex(int(place_cid))[2:]}", # Convert CID to Data ID format "api_key": api_key, } response = requests.get(url, params=params, timeout=30) response.raise_for_status() reviews = response.json().get("reviews", []) for r in reviews[:3]: print(f"User said: {r.get('snippet')}") # AI can now read this: "Great food but rude waiter..."