DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How to Scrape Trustpilot Reviews for Competitor Analysis

Trustpilot has reviews for 1M+ businesses. Here's how to extract them for competitive analysis.

Trustpilot's Public API

Trustpilot pages load review data via internal APIs:

async function getTrustpilotReviews(domain, page = 1) {
  const url = `https://www.trustpilot.com/review/${domain}?page=${page}`;
  const res = await fetch(url, {
    headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' }
  });
  const html = await res.text();

  // Trustpilot embeds review data as JSON-LD
  const jsonLdMatch = html.match(/<script type="application\/ld\+json">(.*?)<\/script>/gs);
  if (jsonLdMatch) {
    for (const match of jsonLdMatch) {
      const json = JSON.parse(match.replace(/<[^>]+>/g, ''));
      if (json['@type'] === 'LocalBusiness' || json.review) {
        return json;
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

What Data You Get

  • Overall rating (1-5 stars)
  • Total review count
  • Individual reviews: text, rating, date, author
  • Business response to reviews
  • Category ranking

Use Cases

  1. Competitor monitoring — track competitor ratings over time
  2. Product development — what do customers complain about?
  3. Market research — which companies lead in customer satisfaction?
  4. Sales intelligence — identify dissatisfied competitor customers
  5. Brand reputation — monitor your own brand

Resources


Need review data from Trustpilot, G2, or Capterra? $20. Email: Spinov001@gmail.com | Hire me

Top comments (0)