Prompt
How do I scrape manufacturer directories?
Latest observation
Scraping manufacturer directories is usually a mix of good data hygiene, careful HTML extraction, and respecting site rules. The exact approach depends on the directory structure, but here’s a practical roadmap.
1) Check legality and permissions first
Before scraping:
- Read the site’s Terms of Service
- Check robots.txt
- Make sure you’re not collecting restricted personal data
- Use polite request rates and identify your bot if appropriate
If the directory offers an API, RSS feed, or export, use that instead.
2) Inspect the page structure
Open the directory in your browser and look for:
- A list of manufacturers on a page
- Pagination or infinite scroll
- Detail pages for each manufacturer
- Search/filter parameters in the URL
Use browser dev tools:
- Elements tab to inspect HTML
- Network tab to see whether the data comes from XHR/JSON calls
If the page is rendered by JavaScript, you may need a browser automation tool or the underlying API endpoint.
3) Decide your scraping method
A. Simple HTML pages
Use:
requests+BeautifulSouplxmlif you want faster parsing
B. JavaScript-rendered pages
Use:
- Playwright or Selenium
- Or inspect the network requests and call the JSON endpoint directly
C. Search/filter via hidden API
Often the best option:
- Find the backend endpoint in Network tab
- Request JSON directly
- This is usually faster and more reliable than browser automation
4) Build a basic scraper
Typical workflow:
- Fetch the directory listing page
- Extract manufacturer links
- Follow each manufacturer detail page
- Parse fields like name, address, phone, website, categories, etc.
- Save to CSV/JSON/database
- Handle pagination
Example with requests + BeautifulSoup
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
base_url = "https://example.com"
listing_url = "https://example.com/manufacturers"
resp = requests.get(listing_url, timeout=20)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
for a in soup.select("a.manufacturer-link"):
name = a.get_text(strip=True)
url = urljoin(base_url, a["href"])
print(name, url)
5) Handle pagination
Look for:
?page=2- “Next” links
- Load-more buttons
Example:
page = 1
while True:
url = f"https://example.com/manufacturers?page={page}"
resp = requests.get(url, timeout=20)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
cards = soup.select(".manufacturer-card")
if not cards:
break
for card in cards:
print(card.get_text(" ", strip=True))
page += 1
6) Extract fields from detail pages
Common fields:
- Company name
- Product categories
- Contact person
- Address
- Phone/email
- Website
- Certifications
- Social links
Example:
detail = requests.get(detail_url, timeout=20)
detail.raise_for_status()
soup = BeautifulSoup(detail.text, "html.parser")
name = soup.select_one("h1").get_text(strip=True)
phone = soup.select_one(".phone").get_text(strip=True) if soup.select_one(".phone") else None
7) Be polite and resilient
Important scraping practices:
- Add a delay:
time.sleep(1) - Use retry logic for transient failures
- Set timeouts
- Avoid hammering the server
- Cache pages if possible
- Respect crawl limits
Example:
import time
import random
time.sleep(random.uniform(1, 3))
8) Normalize and clean data
Directories often have inconsistent formatting. Clean:
- Phone numbers
- URLs
- Addresses
- Duplicate companies
- HTML entities and whitespace
Store raw and cleaned values if possible.
9) If the site is protected
If you encounter:
- Login walls
- CAPTCHAs
- Anti-bot blocking
- Cloudflare/browser challenges
Then:
- Prefer authorized access or an API
- Consider asking for permission or a data export
- Avoid trying to bypass access controls
10) A good architecture
For larger jobs:
- Fetcher: gets pages
- Parser: extracts structured data
- Queue: manages URLs
- Storage: CSV/SQLite/Postgres
- Monitoring: logs errors, retries, counts
If you want, I can help you with one of these next:
- a Python scraper template
- a Playwright scraper for JS-heavy directories
- help scraping a specific manufacturer directory URL
Observation history
Unlock observation history
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.