Skip to content

Rushikesh36/amazon-review-sentiment-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amazon Review Sentiment Analyzer

A powerful Chrome extension that automatically scrapes Amazon product reviews and analyzes customer sentiment using AI. Perfect for market research, competitor analysis, and understanding customer feedback at scale.

🚀 Features

  • Multi-page Scraping: Automatically collects up to 25+ reviews across multiple pages
  • Complete Product Data: Captures product name, price, ASIN, rating, and link
  • Smart Navigation: Auto-detects and navigates to "See all reviews" pages
  • AI-Powered Analysis: Sends reviews to your custom sentiment analysis API
  • Review Details: Extracts rating, title, body, author, date, verified status, and helpful votes
  • Persistent Storage: Saves product info before navigation to preserve pricing data
  • Clean Data Extraction: Removes JavaScript, CSS, and formatting artifacts
  • Beautiful UI: Modern, gradient-styled popup interface with loading states

🛠️ Tech Stack

  • Frontend: HTML5, CSS3, JavaScript (ES6+)
  • Platform: Chrome Extension Manifest V3
  • Storage: Chrome Storage API
  • API Integration: RESTful API calls for sentiment analysis

📦 Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/amazon-review-sentiment-analyzer.git
  2. Open Chrome and navigate to chrome://extensions/

  3. Enable "Developer mode" (toggle in top-right corner)

  4. Click "Load unpacked" and select the extension directory

  5. The extension icon should appear in your Chrome toolbar

🔧 Configuration

Update the API endpoint in popup.js:

const API_ENDPOINT = 'http://localhost:3000/api/analyze-sentiment';

Change this to your actual API URL when ready.

🎯 Use Cases

  • Market Research: Analyze customer sentiment for products in your niche
  • Competitor Analysis: Understand what customers love/hate about competitor products
  • Product Development: Identify common pain points and feature requests
  • E-commerce Strategy: Make data-driven decisions based on customer feedback
  • Brand Monitoring: Track sentiment trends for your products over time

📖 How to Use

  1. Navigate to any Amazon product page
  2. Click the extension icon in your toolbar
  3. Click "Collect Reviews" button
  4. If on product page with limited reviews, click "Go to All Reviews Page"
  5. Wait for the extension to scrape reviews (5-10 seconds)
  6. Click "Analyze Sentiment" to send data to your API
  7. View the API response with sentiment analysis results

📊 API Payload Format

The extension sends the following JSON structure to your API:

{
  "productName": "Product Name Here",
  "productPrice": "$32.99",
  "productLink": "https://www.amazon.com/dp/ASIN",
  "productASIN": "B0CG6QBNSR",
  "productRating": "4.5 out of 5 stars",
  "reviews": [
    {
      "id": 1,
      "rating": 5,
      "title": "Great product!",
      "body": "Review text here...",
      "author": "John Doe",
      "date": "December 20, 2025",
      "isVerified": true,
      "helpfulVotes": 10
    }
  ],
  "timestamp": "2024-12-20T10:30:00.000Z",
  "totalReviews": 25
}

📁 Project Structure

amazon-review-sentiment-analyzer/
│
├── manifest.json          # Extension configuration
├── content.js            # Content script (scraping logic)
├── popup.html            # Extension popup UI
├── popup.js              # Popup logic and API calls
├── icon.png              # Extension icon
├── README.md             # Documentation
│
└── screenshots/          # UI screenshots
    ├── main-interface.png
    └── reviews-collected.png

🔑 Key Features Explained

Multi-Page Navigation

The extension automatically clicks through Amazon's pagination to collect exactly 25 reviews, handling:

  • "Next page" button detection
  • Page load waiting (3 seconds between pages)
  • Safety limits (max 5 pages)

Product Info Preservation

When navigating from product page to reviews page:

  1. Extension captures complete product info (including price)
  2. Saves to Chrome storage
  3. Retrieves on reviews page
  4. Ensures no data loss during navigation

Clean Data Extraction

Removes common Amazon artifacts:

  • JavaScript code snippets
  • CSS style blocks
  • "Read more" / "Read less" text
  • Extra whitespace and newlines

🌐 Supported Amazon Domains

  • amazon.com (United States)
  • amazon.co.uk (United Kingdom)
  • amazon.in (India)
  • amazon.ca (Canada)

🐛 Troubleshooting

Extension not working?

  • Refresh the Amazon page after installing
  • Check that you're on a product page with reviews
  • Open Chrome DevTools (F12) and check Console for errors

Not collecting 25 reviews?

  • Make sure you're on the "See all reviews" page
  • Some products may have fewer than 25 reviews available
  • Check that pagination buttons are visible on the page

Price showing as "Price not available"?

  • Some Amazon pages hide prices (sign-in required, out of stock)
  • Try refreshing the product page
  • Check if you need to be logged into Amazon

💡 API Development Tips

Your backend API should:

  1. Accept POST requests at /api/analyze-sentiment
  2. Parse the JSON payload
  3. Perform sentiment analysis on review bodies
  4. Return structured JSON response

Example API response format:

{
  "success": true,
  "sentiment": {
    "positive": 20,
    "negative": 3,
    "neutral": 2
  },
  "summary": "Overall positive sentiment"
}

About

Chrome extension analyzing Amazon review sentiment with multi-page scraping, AI analysis, persistent storage. Manifest V3.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors