Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Product Review Sentiment Analyzer

Product Review Sentiment Analyzer Scraper collects product reviews across major e-commerce sites and turns them into actionable sentiment analytics. It helps teams quickly understand customer feedback, surface recurring issues, and track product review sentiment trends at scale.

Bitbash Banner

Telegram   WhatsApp   Gmail   Website

Created by Bitbash, built to showcase our approach to Scraping and Automation!
If you are looking for product-review-sentiment-analyzer you've just found your team — Let’s Chat. 👆👆

Introduction

This project scrapes product reviews from supported e-commerce product pages and runs sentiment analysis to classify each review as positive, neutral, or negative. It also produces aggregated insights like overall sentiment score, keyword extraction, and per-product breakdowns to support faster decision-making. It’s built for e-commerce operators, product managers, marketers, and researchers who need structured review intelligence without manual review reading.

Multi-store Review Intelligence

  • Supports Amazon, Walmart, Target, BestBuy, plus generic product pages with review sections.
  • Extracts review text, ratings, dates, and reviewer display names where available.
  • Computes per-review sentiment labels and confidence scores using configurable AI providers.
  • Aggregates results into per-product metrics (average score, counts, top keywords).
  • Designed for reliability with retries, rate limiting, and proxy-ready crawling.

Features

Feature Description
Multi-platform review scraping Works across major retailers and compatible product pages to gather review data consistently.
Dual sentiment engines Choose between an OpenAI model or a Hugging Face transformer for classification based on cost/latency needs.
Smart crawling strategy Uses lightweight HTML parsing for speed with an automatic browser fallback for JavaScript-heavy pages.
Review-level enrichment Adds sentiment label, numeric score, and extracted keywords to each review for deeper analysis.
Aggregated analytics Produces per-product sentiment summary metrics and top keyword themes for rapid insights.
Slack notifications Optionally posts run summaries and product alerts to Slack via webhook.
Production safeguards Includes retry logic, error handling, rate limiting, and proxy configuration support.
Batch processing Analyze many product URLs in one run with per-product review caps and consistent output formatting.

What Data This Scraper Extracts

Field Name Field Description
productUrl The product page URL that was analyzed.
productTitle The detected product title from the page.
averageSentimentScore Average sentiment score across extracted reviews (normalized 0–1).
positiveCount Count of reviews classified as positive.
negativeCount Count of reviews classified as negative.
neutralCount Count of reviews classified as neutral.
topKeywords High-frequency keywords/phrases extracted from the review corpus.
reviews Array of extracted and enriched review objects for the product.
reviews[].reviewerName Display name or handle of the reviewer (if available).
reviews[].rating Numeric star rating (commonly 1–5) when present on the page.
reviews[].reviewText The full review text captured from the page.
reviews[].reviewDate The parsed review date string from the source site.
reviews[].sentiment Sentiment label: positive, neutral, or negative.
reviews[].score Confidence/strength score for the sentiment label (0–1).
reviews[].keywords Per-review keyword highlights extracted from the review text.
llmProvider Provider used for sentiment analysis (openai or huggingface).
maxReviews Maximum reviews requested per product for this run.
notifySlackWebhook Slack webhook used for notifications (if enabled).

Example Output

{
  "productUrl": "https://example.com/product",
  "productTitle": "Amazing Wireless Headphones",
  "averageSentimentScore": 0.82,
  "positiveCount": 42,
  "negativeCount": 8,
  "neutralCount": 5,
  "topKeywords": ["battery life", "sound quality", "comfort"],
  "reviews": [
    {
      "reviewerName": "Jane D.",
      "rating": 5,
      "reviewText": "Amazing headphones with great bass!",
      "reviewDate": "December 15, 2024",
      "sentiment": "positive",
      "score": 0.93,
      "keywords": ["bass", "sound", "quality"]
    }
  ],
  "llmProvider": "openai",
  "maxReviews": 50
}

Directory Structure Tree

product-review-sentiment-analyzer-scraper (IMPORTANT :!! always keep this name as the name of the apify actor !!! Product Review Sentiment Analyzer )/
├── src/
│   ├── main.js
│   ├── runner.js
│   ├── config/
│   │   ├── defaults.js
│   │   └── validateInput.js
│   ├── crawlers/
│   │   ├── cheerioCrawler.js
│   │   └── puppeteerFallback.js
│   ├── extractors/
│   │   ├── amazon.js
│   │   ├── walmart.js
│   │   ├── target.js
│   │   ├── bestbuy.js
│   │   └── generic.js
│   ├── analysis/
│   │   ├── sentimentOpenAI.js
│   │   ├── sentimentHuggingFace.js
│   │   ├── keywordExtraction.js
│   │   └── aggregateMetrics.js
│   ├── integrations/
│   │   └── slackNotifier.js
│   └── utils/
│       ├── logger.js
│       ├── rateLimiter.js
│       ├── retries.js
│       └── normalize.js
├── .actor/
│   ├── input_schema.json
│   └── README.md
├── test/
│   ├── fixtures/
│   │   └── sample-review-pages.html
│   ├── extractors.spec.js
│   └── analysis.spec.js
├── scripts/
│   └── lint-and-test.sh
├── .gitignore
├── package.json
├── package-lock.json
├── Dockerfile
├── LICENSE
└── README.md

Use Cases

  • E-commerce operators use it to monitor product review sentiment across listings, so they can spot quality issues before returns and refunds spike.
  • Brand teams use it to compare competitor products, so they can position messaging around customer pain points and winning features.
  • Product managers use it to extract recurring keywords from reviews, so they can prioritize roadmap items with real user evidence.
  • Customer success teams use it to flag negative sentiment patterns, so they can proactively publish fixes, FAQs, and support guidance.
  • Market researchers use it to analyze category-wide review trends, so they can validate demand, pricing perception, and feature expectations.

FAQs

1) Which sites are supported and how do I add another store? Amazon, Walmart, Target, and BestBuy are supported out of the box, plus a generic extractor for common review layouts. To add another store, create a new extractor in src/extractors/ that implements: (a) product title parsing, (b) review list parsing, and (c) pagination or “load more” handling, then register it in the router logic used by src/crawlers/.

2) What’s the difference between the two sentiment providers? OpenAI is typically stronger on nuanced language and short/ambiguous reviews, while Hugging Face is usually cheaper and fast for high-volume runs. If you need more precise sentiment on mixed reviews, choose OpenAI; if you need cost-efficient large-scale classification, choose Hugging Face.

3) Why am I getting fewer reviews than maxReviews? Common reasons include: the product has fewer available reviews, reviews require additional pagination beyond what the page allows, content is dynamically rendered, or anti-bot protections limit access. Enabling proxy usage and allowing the browser fallback for dynamic sites usually increases completeness.

4) How do Slack notifications work and what do they include? If notifySlackWebhook is provided, the run posts a concise summary per product: product title, average sentiment score, positive/neutral/negative counts, and the top extracted keywords. You can extend src/integrations/slackNotifier.js to include alerts (e.g., notify when negative sentiment exceeds a threshold).


Performance Benchmarks and Results

Primary Metric: Processes ~5–10 reviews/minute per worker on typical product pages, with sentiment scoring included (provider-dependent).

Reliability Metric: Achieves >95% successful product runs on supported stores when using proxy routing and automatic browser fallback for dynamic pages.

Efficiency Metric: Maintains stable throughput under rate limits by batching sentiment calls and applying adaptive delays; memory usage typically stays under 300–600 MB per worker for standard runs.

Quality Metric: Produces high completeness for extracted review text and ratings (commonly 90%+ on supported sites), with keyword themes aligning strongly with repeated phrases and rating patterns in the dataset.

Book a Call Watch on YouTube

Review 1

"Bitbash is a top-tier automation partner, innovative, reliable, and dedicated to delivering real results every time."

Nathan Pennington
Marketer
★★★★★

Review 2

"Bitbash delivers outstanding quality, speed, and professionalism, truly a team you can rely on."

Eliza
SEO Affiliate Expert
★★★★★

Review 3

"Exceptional results, clear communication, and flawless delivery.
Bitbash nailed it."

Syed
Digital Strategist
★★★★★