Prompt
How do I pull contact info from a directory site into CSV?
Latest observation
Oct 4, 2026
OpenAI APIWeb search: off
If the directory site allows it, the basic workflow is:
-
Check the site’s terms and robots policy
- Make sure scraping/exporting contact info is allowed.
- Prefer an official API, export, or bulk download if available.
-
Identify the fields you want
- For example: name, company, phone, email, address, website, category.
-
Inspect the page structure
- Open the directory listing page in your browser.
- Use DevTools to find the HTML elements containing the data.
-
Choose a method
- No-code: browser scraper extensions, spreadsheet import tools, or automation tools.
- Code: Python with
requests+BeautifulSoup, orscrapyfor bigger jobs. - Dynamic pages: use
playwrightorseleniumif content loads via JavaScript.
-
Save to CSV
- Write extracted records into a CSV file with consistent columns.
Example in Python for a simple static page:
import csv
import requests
from bs4 import BeautifulSoup
url = "https://example.com/directory"
html = requests.get(url, timeout=30).text
soup = BeautifulSoup(html, "html.parser")
rows = []
for card in soup.select(".listing-card"):
name = card.select_one(".name").get_text(strip=True) if card.select_one(".name") else ""
phone = card.select_one(".phone").get_text(strip=True) if card.select_one(".phone") else ""
email = card.select_one(".email").get_text(strip=True) if card.select_one(".email") else ""
rows.append({"name": name, "phone": phone, "email": email})
with open("contacts.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=["name", "phone", "email"])
writer.writeheader()
writer.writerows(rows)
If the site has multiple pages, loop through page URLs and append results to the same CSV.
If you want, I can help you with:
- a Python script
- a no-code method
- or a site-specific scraper if you share the directory site and the fields you need.