Skip to content

Repository files navigation

trustpilot-scraper

CI Python License: MIT

Scrape Trustpilot company reviews as clean, structured JSON — review title, body, star rating, author and date, plus the company's aggregate TrustScore and total review count — for any company domain.

Great for reputation monitoring, competitor research, complaint triage, and review analytics.

Powered by ScrapeUnblocker. Reviews are fetched through the getPageSource parsed-data API, which returns Trustpilot review pages as AI-parsed JSON — so there is no brittle HTML parsing to maintain, and anti-bot protection is handled for you.

Features

  • 🧾 Clean JSON reviewstitle, body, rating, author, date.
  • Company summary — aggregate TrustScore and total review count.
  • 📄 Multi-page collection — walk as many pages as you need, with automatic de-duplication of reviews that overlap between pages.
  • 🎯 Rating filters — request specific star ratings from Trustpilot and/or filter locally by a minimum rating.
  • 💾 JSON or CSV output — from the CLI or the library.
  • 🧪 Tested & typed — offline unit tests that mock the API (no credits spent).

Install

pip install .
# or, for development:
pip install -e ".[dev]"

Set your API key (get one at scrapeunblocker.com):

export SCRAPEUNBLOCKER_KEY=your_key_here      # Windows: set SCRAPEUNBLOCKER_KEY=your_key_here

Or copy .env.example to .env and fill it in.

CLI usage

# 100 most recent reviews for Nike, as JSON
trustpilot-scraper www.nike.com

# 25 one- and two-star reviews for Amazon, as CSV
trustpilot-scraper www.amazon.com -n 25 --stars 1 2 -f csv -o amazon.csv

# only reviews rated 4 stars or higher
trustpilot-scraper www.nike.com --min-rating 4

The company argument is the domain exactly as it appears in the Trustpilot review URL (https://www.trustpilot.com/review/<company>), e.g. www.nike.com. A full Trustpilot review URL also works.

positional arguments:
  company               Company domain (e.g. www.nike.com) or a Trustpilot review URL.

options:
  -n, --max-reviews N   Maximum number of reviews to collect (default: 100).
  --max-pages N         Maximum number of pages to fetch (default: 20).
  --start-page N        Page number to start from (default: 1).
  --stars N [N ...]     Only request reviews with these star ratings (1-5).
  --min-rating {1..5}   Drop reviews below this star rating after fetching.
  --proxy-country CODE  ISO country code to route through (default: us).
  -f, --format {json,csv}
  -o, --output FILE     Write to a file instead of stdout.

Library usage

from trustpilot_scraper import TrustpilotScraper

scraper = TrustpilotScraper()  # reads SCRAPEUNBLOCKER_KEY

result = scraper.scrape("www.nike.com", max_reviews=40, stars=[1, 2])

print(result.name, result.aggregate_rating, result.total_reviews)
for review in result.reviews:
    print(review.rating, review.title, "-", review.author)

# stream reviews lazily instead of collecting them all
for review in scraper.iter_reviews("www.amazon.com", max_reviews=200):
    ...

Example output

{
  "company": "www.nike.com",
  "name": "Nike",
  "aggregate_rating": 1.5,
  "total_reviews": 13047,
  "reviews": [
    {
      "title": "Large order disappeared",
      "body": "I placed a large order for delivery to a pickup point ...",
      "rating": 1,
      "author": "UB",
      "date": "2026-08-31T12:05:25.000Z"
    }
  ]
}

Examples

Project layout

src/trustpilot_scraper/
  __init__.py     package exports + version
  models.py       Review / CompanyReviews data models
  scraper.py      scraping, pagination, retry and parsing logic
  cli.py          argparse command-line interface
examples/         runnable example scripts
tests/            offline unit tests (SDK mocked)

Development

make install    # editable install with dev deps
make lint       # ruff check
make format     # ruff format
make test       # pytest
make run        # sample CLI run

How it works

Each review page is fetched with the ScrapeUnblocker Python SDK:

from scrapeunblocker import Client

client = Client()  # reads SCRAPEUNBLOCKER_KEY
parsed = client.get_parsed("https://www.trustpilot.com/review/www.nike.com", proxy_country="us")
parsed.data  # {"page": {...}, "results": {"aggregate_rating", "total", "items": [...]}}

Trustpilot paginates with ?page=N; this scraper walks pages until it reaches your limit or a page returns no new reviews. Transient upstream errors are retried with exponential backoff.

Links

License

MIT © 2026 ScrapeUnblocker


This project scrapes only publicly available review data. Please review Trustpilot's Terms of Service and applicable laws, and scrape responsibly.

About

Scrape Trustpilot company reviews as clean JSON - title, body, star rating, author, date, plus aggregate TrustScore and total count - for any company domain, with multi-page collection, rating filters and CSV export, via the ScrapeUnblocker getPageSource parsed_data API. CLI + Python library.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages