Prompt
How do I scrape online marketplaces?
Latest observation
Scraping online marketplaces can be useful for price research, product monitoring, or catalog building, but you should do it carefully because many marketplaces restrict automated access in their terms of service and may block bots.
Here’s a practical, compliant approach:
1) Check legality and permissions first
- Read the site’s Terms of Service
- Check robots.txt for crawl rules
- Prefer official APIs or data feeds when available
- Avoid scraping personal data, private seller info, or anything behind login/paywalls without permission
2) Define exactly what you need
Examples:
- Product title
- Price
- Shipping cost
- Seller name/rating
- Availability
- Product URL
This helps you keep requests minimal and reduces risk.
3) Use the lightest method possible
Best option: API
If the marketplace provides an API, use that instead of scraping HTML.
Next best: static HTML scraping
If product pages contain the data in the HTML, use:
requestsBeautifulSouplxml
If the site is heavily JavaScript-driven
Use a browser automation tool:
PlaywrightSelenium
4) Be polite and avoid being blocked
- Send a clear User-Agent
- Add delays between requests
- Limit concurrency
- Cache responses
- Don’t hammer search pages repeatedly
- Respect rate limits if they exist
5) Handle common marketplace complications
- Pagination
- Infinite scroll
- Lazy-loaded images/data
- Variant products
- Sponsored listings
- Locale/currency differences
- Dynamic pricing
6) Example: basic HTML scraping in Python
import requests
from bs4 import BeautifulSoup
url = "https://example.com/products"
headers = {
"User-Agent": "Mozilla/5.0 (compatible; MyResearchBot/1.0)"
}
resp = requests.get(url, headers=headers, timeout=15)
resp.raise_for_status()
soup = BeautifulSoup(resp.text, "html.parser")
for item in soup.select(".product-card"):
title = item.select_one(".title").get_text(strip=True)
price = item.select_one(".price").get_text(strip=True)
link = item.select_one("a")["href"]
print(title, price, link)
7) Example: use Playwright for JS-rendered pages
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
page.goto("https://example.com/products", wait_until="networkidle")
cards = page.locator(".product-card")
for i in range(cards.count()):
card = cards.nth(i)
title = card.locator(".title").inner_text()
price = card.locator(".price").inner_text()
print(title, price)
browser.close()
8) Store and clean the data
Use:
- CSV for small projects
- SQLite/PostgreSQL for larger ones
Normalize:
- Currency
- Shipping
- Dates
- Text casing
- Missing values
9) Monitor for changes
Marketplace layouts change often, so:
- Write selectors defensively
- Log failures
- Add alerts when parsing breaks
- Keep test pages/sample HTML
10) Don’t try to bypass protections
Avoid techniques meant to evade anti-bot systems, CAPTCHA, login restrictions, or access controls. If the marketplace blocks automation, the safe path is usually:
- Use their API
- Ask for permission
- Reduce request volume
- Use an approved data provider
If you want, I can help you with:
- a Python scraper template,
- scraping a specific marketplace page, or
- choosing between
requests,BeautifulSoup, and Playwright.
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.