That is an insightful question, and the answer is Yes, but not by using "ChatGPT Nano."
While you already have the correct key and tool to reliably get contact information from Google: the Google Maps Geocoding API key.
Since Yell.com is actively blocking your scraper with a Cloudflare challenge, you should switch your data enrichment step to use Google's official, reliable API.
The Best Fix: Use the Google Maps API
The most effective solution is to repurpose the $\mathbf{get_coordinates_from_address}$ function you already have to get the full business details (including phone and name verification) directly from Google's database.
Google Maps APIs (specifically the Places API which works with your existing key structure) are designed to provide structured data like phone numbers and websites for businesses without needing to scrape them.
1. Add a Google Places Search Function
You need a new function to search Google Places using the business name and address you got from Companies House. This is similar to how your old $\mathbf{scrape_yell}$ function worked, but using a reliable API endpoint instead of scraping:
def get_contact_from_google_places(company_name, address):
# This key is already defined in your config:
# GOOGLE_MAPS_API_KEY = "AIzaSy..."
# Use the Places Find Place API, which is often reliable for name/address lookups
url = "https://maps.googleapis.com/maps/api/place/findplacefromtext/json"
# Create the search query combining name and address
search_query = f"{company_name}, {address}"
params = {
"input": search_query,
"inputtype": "textquery",
# Request specific fields, including phone number and website
"fields": "name,formatted_phone_number,website",
"key": GOOGLE_MAPS_API_KEY
}
try:
response = requests.get(url, params=params, timeout=10)
data = response.json()
if data.get("candidates"):
first_match = data["candidates"][0]
return {
"phone": first_match.get("formatted_phone_number", "N/A"),
"website": first_match.get("website", "N/A")
}
except Exception as e:
print(f" Google Places API Error: {e}")
return {"phone": "N/A", "website": "N/A"}
2. Replace the $\mathbf{scrape_yell}$ Call
In your main execution loop, you simply replace the call to the failing $\mathbf{scrape_yell}$ with the reliable $\mathbf{get_contact_from_google_places}$.
Original (Failing) Snippet in the main loop:
# --- STEP 3a: YELL SCRAPING (Contact Enrichment) ---
yell_data = scrape_yell(row["name"], row["address"])
df.loc[index, "phone"] = yell_data["phone"]
df.loc[index, "website"] = yell_data["website"]
# Reload the 'row' object to reflect the new data from df.loc
row = df.loc[index]
print(f" Phone: {row['phone']} | Website: {row['website']}")
New (Reliable) Snippet:
# --- STEP 3a: GOOGLE PLACES API (Contact Enrichment) ---
google_data = get_contact_from_google_places(row["name"], row["address"])
df.loc[index, "phone"] = google_data["phone"]
df.loc[index, "website"] = google_data["website"]
# Reload the 'row' object to reflect the new data from df.loc
row = df.loc[index]
print(f" Phone: {row['phone']} | Website: {row['website']}")
By making this change, you solve the scraping issue, bypass the Cloudflare block, and use a dedicated, legal API service for contact lookup, which is far more reliable for building your business directory.