How To Scrape Amazon Reviews Using Python (2025)

Sukhdev MiyatraMarch 25, 20258 min read

How to scrape amazon reviews

Amazon is the go-to marketplace for millions of shoppers. And what’s the first thing people check before buying? The reviews.

Whether you're a brand, a marketer, or just someone doing research, getting access to a large number of Amazon reviews can be incredibly valuable.

But there’s a problem: Amazon doesn’t make it easy. As of November 5th, 2024, you now have to be logged in to see more than a handful of reviews.

This means scraping Amazon reviews the old-fashioned way has become a nightmare. Bots get blocked, CAPTCHAs pop up everywhere, and unless you like dealing with login sessions and headless browsers, you’re in for a rough time.

In this turorial, we will teach you the two methods for web scraping Amazon reviews.

Two Methods to Scrape Amazon Reviews

There are two primary ways to extract Amazon reviews:

  1. Using Python: A DIY method where you write a scraper using BeautifulSoup and requests.
  2. Using Unwrangle API: A hassle-free approach that bypasses login restrictions, CAPTCHAs, and geo-restrictions.

In this guide, we’ll walk you through both methods and explain what each approach can scrape.

What We Will Scrape In This Tutorial

With Python Method:

  • Product Title
  • Reviewer Names
  • Review Titles
  • Review Texts
  • Review Ratings
  • Review Dates
  • Review Images (if available)

With Unwrangle API Method:

  • Everything Python can scrape, plus:
  • More reviews than Amazon allows per page
  • Filter reviews by keywords (e.g., "battery life")
  • Filter by positive or critical reviews
  • Retrieve reviews from more countries
  • Fetch reviews for all variants or a specific one
  • Get media reviews only (images/videos)

Let's first understand how Amazon prevents scraping.

Understanding Amazon's Anti-Scraping Measures

Amazon implements multiple layers of security to prevent automated data extraction, making it challenging for scrapers. Here are some of the major obstacles:

Amazon Review Challenges

Method 1: Step-by-Step Guide to Extracting Amazon Reviews Using Python

Step 1: Install Required Libraries

Ensure you have requests, beautifulsoup4 and csv installed:

bash
1pip install requests beautifulsoup4 csv

Step 2: Import Libraries

python
1import requests
2from bs4 import BeautifulSoup
3import time
4import random
5import csv

Step 3: Define Headers to Avoid Blocks

Amazon aggressively blocks bots, so you should use headers to mimic a real browser.

python
1headers = {
2 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
3 "Accept-Language": "en-US,en;q=0.9",
4}

Step 4: Fetch the Amazon Product Page

Replace URL_HERE with the actual Amazon product page URL.

python
1url = "URL_HERE"
2response = requests.get(url, headers=headers)
3if response.status_code != 200:
4 print("Failed to retrieve the page. Status code:", response.status_code)
5 exit()
6soup = BeautifulSoup(response.content, "html.parser")

Step 5: Extract Data from Reviews

Finding the Selectors for Specific Elements

To extract these attributes, you'll need to locate their unique CSS selectors. Use your browser's Inspect tool (F12) to examine the page's structure and identify the relevant selectors.

Amazon Review browser inspect elements

For example:

  • Reviewer Name is in the <span> tag with the class a-profile-name
  • Review Title is found in an <a> tag with data-hook="review-title"
  • Review Text is stored in a <span> tag with data-hook="review-body"
  • Review Rating is found inside an <i> tag with data-hook="review-star-rating"
  • Review Date appears in a <span> tag with data-hook="review-date"
  • Review Images can be found in the src attribute of an <img> tag with data-hook="review-image-tile"

Extract Reviewer Names

python
1reviewer_names = [name.text.strip() for name in soup.select(".a-profile-name")]

Extract Review Titles

python
1review_titles = [
2 title.find_all("span")[-1].text.strip() # Extract last span inside &#x3C;a data-hook="review-title">
3 for title in soup.find_all("a", {"data-hook": "review-title"})
4 ]

Extract Review Texts

python
1review_texts = [text.text.strip() for text in soup.select('[data-hook="review-body"]')]

Extract Review Ratings

python
1review_ratings = [rating.text.strip() for rating in soup.find_all("i", {"data-hook": "review-star-rating"})]

Extract Review Dates

python
1review_dates = [date.text.strip() for date in soup.select('[data-hook="review-date"]')]

Extract Review Images (if available)

python
1review_images = []
2for img in soup.find_all("img", {"data-hook": "review-image-tile"}):
3 image_url = img.get("data-src", img.get("src", "N/A")) # Uses `data-src` if available, otherwise `src`
4 review_images.append(image_url)

Step 6: Save Reviews to CSV

python
1with open("amazon_reviews.csv", "w", newline="", encoding="utf-8") as file:
2 writer = csv.writer(file)
3 writer.writerow(["Reviewer Name", "Review Title", "Review Text", "Review Rating", "Review Date", "Review Images"])
4
5 for i in range(len(reviewer_names)):
6 writer.writerow([
7 reviewer_names[i] if i &#x3C; len(reviewer_names) else "N/A",
8 review_titles[i] if i &#x3C; len(review_titles) else "N/A",
9 review_texts[i] if i &#x3C; len(review_texts) else "N/A",
10 review_ratings[i] if i &#x3C; len(review_ratings) else "N/A",
11 review_dates[i] if i &#x3C; len(review_dates) else "N/A",
12 review_images[i] if i &#x3C; len(review_images) else "N/A"
13 ])
14
15print("Reviews successfully saved to amazon_reviews.csv")

Preview:

Amazon Review data preview

You can also check our tutorial on how to scrape Amazon product details with python.

Method 2: Scraping Amazon Reviews Using Unwrangle API

Unwrangle offers a far superior alternative to manual scraping:

  • Retrieve reviews from more countries

  • Filter reviews by keyword (e.g., "battery life")

  • Get more reviews than allowed per page

  • Filter by positive or critical reviews

  • Fetch reviews for all or specific variants

  • Retrieve media reviews only (images/videos)

For more Info Check Our Documentation Page: Amazon Product Reviews API

How to Use Unwrangle API to Scrape Amazon Reviews

Step 1: Prerequisites

Before making API requests, ensure you have the following:

  • Requests library Run the following command from your terminal(if you don't have the requests library installed already):
bash
1pip install requests
  • Unwrangle API Key: Sign up on Unwrangle to get one
  • Amazon Cookie: Extract your session cookie after logging in to Amazon

How to Get or Extract Amazon Cookies:

To scrape Amazon reviews, you need to provide your Amazon session cookie (cookie parameter). Here’s how you can extract it from your browser:

  1. Go to Amazon and log into your account.
  2. Right-click anywhere and select Inspect.
  3. Navigate to the Application tab.
  4. Under Storage, click Cookies and select amazon.com.
  5. Look for a cookie named session-id or session-token.
  6. Copy its value and use it in your API request.

Step 2: Making a Basic API Request

Use the following Python script to fetch Amazon reviews using Unwrangle:

python
1import requests
2
3API_URL = "https://data.unwrangle.com/api/getter/"
4
5params = {
6 "url": "https://www.amazon.com/essence-Princess-Effect-Mascara-Cruelty/dp/B00T0C9XRK",
7 "page": 1,
8 "platform":"amazon_reviews",
9 "filter_by_star": "positive", # Filter by positive reviews
10 "sort_by": "recent", # Or "helpful"
11 "api_key": "YOUR_API_KEY",
12 "media_type": "media_reviews_only", # Fetch only image/video reviews
13 "cookie": "YOUR_AMAZON_COOKIE"
14}
15
16response = requests.get(API_URL, params=params)
17data = response.json()
18print(data["reviews"])

Step 3: Response Format

Each request returns up to 10 results. The response will include the following attributes:

Attributes Returned Data Type Information Represented
id string Retailer ID of the review
date string Date when review was published
author_name string Reviewer's name
author_url string Reviewer's retailer profile link
rating int Rating by reviewer
review_title string Review title
review_url string Link to review
review_text string Review's text content
review_imgs list Links to reviewer's images, if any
review_videos list Links to reviewer's videos, if any
meta_data dict Dict containing meta data. For example, verified purchase status and variant info
meta_data.verified_purchase boolean Whether the review is from a verified purchase
meta_data.variant_info list List of variant details for the reviewed product
meta_data.helpful_vote_count int Number of helpful votes for the review
location string Country-level location of reviewer
rating_distribution dict Distribution of ratings for the product

Step 4: Handling the API Response

Once you receive the JSON response, you can extract and analyze the data:

python
1if response.status_code == 200:
2 reviews = data.get("reviews", [])
3 for review in reviews:
4 print(f"Rating: {review['rating']}, Review: {review['review_text']}")
5else:
6 print(f"Error: {data.get('message', 'Unknown error')}")

Preview:

Amazon Review Unwrangle Preview

More Ways to Scrape Amazon Data

If you are looking for other Amazon data we have also APIs for:

With these, you can Instantly retrieve product details like prices, images, and descriptions. Easily fetch customer reviews, including ratings and review text. Get structured JSON responses that are easy to integrate into your code.