How to Scrape Amazon Reviews With Python (2025)

22 August 2025 | 12 min read

Amazon review scraping is a great way for other retailers to learn about customer wants and needs through one of the biggest retailers in e-commerce. However, many are discouraged from trying it due to the technical barrier of writing code.

If you want to access Amazon product reviews in a user-friendly way, there is no better combo than working with our HTML API through Python and its many additional libraries that help extract data from product pages. In this guide, we will cover the basics of targeting local Amazon reviews, so follow along and soon you'll be able to test the service, guaranteeing a reliable web scraping experience.

Quick Answer (TL;DR)

To scrape Amazon reviews with Python, use our robust HTML API to handle data extraction and parsing. All you need is to define appropriate CSS selectors which contain review data, while our tools will automatically handle JavaScript rendering.

The following code is an example of a working Amazon Reviews scraper that exports collected data into a csv file for easy analysis. If you need more help, check out our Amazon Reviews Scraping API.

from scrapingbee import ScrapingBeeClient
import pandas as pd
#initializing our HTML API client
client = ScrapingBeeClient(api_key='YOUR_API_KEY')

def amazon_reviews(asins):
#CSS selector for product title
    extract_rules = {
        "product_title": {
            "selector":"span.a-size-large.product-title-word-break",
            "output":"text"
        },
#List of CSS seelctors targeting Amazon review data
        "properties": {
            "selector": "#cm-cr-dp-review-list > li",
            "type": "list",
            "output": {
                 "name": ".a-profile-name",
                 "rating": ".review-rating > span",
                 "date": ".review-date",
                 "title": ".review-title span:not([class])",
                 "content": ".review-text"
            }
        }
    }
# Instructions for JavaScript Rendering that will scroll the loaded webpage
    js_scenario = {
        "instructions":[
            {"wait": 2000},
            {"evaluate": "window.scrollTo(0, document.body.scrollHeight);"},
            {"wait": 2000},           
        ]
    }

    all_reviews = []
#Looping GET API calls through different ASIN code URLs
    for asin in asins:
        response = client.get(
            f'https://www.amazon.com/dp/{asin}',
            params={ 
                "extract_rules": extract_rules,
                "js_scenario": js_scenario,
                "country_code": "us"
            },
            retries=2
        )
#extracting data points in a consistent format to feed them to the data frame
        product_title=response.json().get('product_title')

        title_entry = {
        "name": product_title,
        "rating": "",
        "date": "",
        "title":"",
        "content": ""
        }
# adding all extracted data to one list
        all_reviews.append(title_entry)
        reviews = response.json().get('properties', [])
        all_reviews.extend(reviews)
# Checks if extraction is successful    
        print(f"{asin}: {response.status_code}, {len(reviews)} reviews extracted")
# transforming the "all_reviews" variable into a data frame before CSV export
    df = pd.DataFrame(all_reviews)
    df.to_csv("all_reviews.csv", index=False)

# Example ASIN list
asin_list = ["B0CTH2QF23", "B0CCDTPDTQ","B099WTN2TR"]
# Calling the defined scraper function
amazon_reviews(asin_list)

Setup: Get Started With ScrapingBee API

To build Amazon Reviews scraping from scratch, first we have to set up your programming environment. Unlike other data collection scripts that require multiple extra libraries, using our API keeps things much simpler.

Start by downloading and installing Python on your device – visit the official Python website and follow the step-by-step installation wizard. As the biggest coding language, it will unlock access to the tools and libraries needed to run API requests and handle extracted data.

Now log in or register your ScrapingBee account. If you're new to our tools, you can follow this tutorial using a free week-long trial that includes 1,000 API credits:

Register

After signing up, you'll land on the dashboard, where you can find your API key displayed in the top right section. Copy it, because you'll need it to initialize the API client variable within the code.

Dashboard

Before we create a new .py file to scrape review data, install the following packages using pip – Python’s built-in package manager:

  • scrapingbee – connects your script to our HTML API, allowing you to send requests, extract, and web data effortlessly.

  • pandas – Structures and processes the extracted data, making it easy to view, analyze, or export to formats like CSV.

Go to your Terminal (or Command Prompt on Windows systems) and enter the following line:

pip install scrapingbee pandas

Now it's time to get your hands dirty. Create a new python file, for example "amazon_reviews.py" and import the downloaded libraries at the top of the script:

from scrapingbee import ScrapingBeeClient
import pandas as pd

Then, start the API client by assigning it to a "client" variable. This is where your API key will authenticate your access to our tools.

client = ScrapingBeeClient(api_key='A0I5QA6KVT1I6NP8LXLJRJDYF43WVALD5KP2ZJYCHUIHS3K8THI0X8NC9O4LTZTBW687ASU0M6O2KXM5')

Let's start building our Amazon Reviews Scraper by defining all logic within the "amazon_reviews" function. Right below it, we add an "extract_rules" parameter, which will define the parsing logic by assigning CSS selectors from loaded Amazon Reviews.

#extract_rules - a nested dictionary variable that picks out the desired parts of HTML code
    extract_rules = {
        "properties": {
            "selector": "#cm-cr-dp-review-list > li",
            "type": "list",
            "output": {
                 "name": ".a-profile-name",
                 "rating": ".review-rating > span",
                 "date": ".review-date",
                 "title": ".review-title span:not([class])",
                 "content":".review-text"
            }
        }
    }

Okay, now that is a lot to unpack. Let's break down this list of extract_rules for parameters within each Amazon review:

  • name: .a-profile-name – The reviewer’s username, taken from the profile name element.

  • rating: .review-rating > span – The star rating text, inside the review rating span.

  • date: .review-date – The date the review was posted, from the review date label.

  • title: .review-title span:not([class]) – The review’s headline text, selecting only plain spans (ignoring styled ones).

  • content: .review-text – The main review body text, from the review content block.

Review

Still, we are not done yet. There is another dictionary of parameters, js_scenario, which characterizes the rules for JavaScript rendering for our built-in headless browser. It is a way to control the built-in headless browser that executes JavaScript on the page, and we add it with a following set of instructions:

    js_scenario = {
        "instructions":[
            {"wait": 2000},
            {"evaluate": "window.scrollTo(0, document.body.scrollHeight);"},
            {"wait": 2000},           
        ]
    }

Here’s a simple breakdown of the js_scenario instructions:

  • {"wait": 2000} – Pauses execution for 2 seconds (2000 ms) to allow the page to load content before moving on.

  • `{"evaluate": "window.scrollTo(0, document.body.scrollHeight);"} – Runs custom JavaScript that scrolls the page to the very bottom, triggering lazy loading of additional content (like reviews or listings).

Note: Another parameter you might come across is render_js=true, which enables a headless browser for JavaScript rendering. Our API has it set to true by default, so you don't need to add it explicitly to scrape Amazon product reviews.

Need more info to customize your GET API requests? Take a look at our documentation page to have full control over your automated connections.

Write Your First Request

It's time to initiate the GET API request. The following lines of code retrieve the URL code of a specific product to extract reviews from Amazon:

 #ASIN of a random product – Govee Floor Lamp
   asin = "B0CTH2QF23L"
    response = client.get(
        f'https://www.amazon.com/dp/{asin}',
        params={
 #assigning previously defined parameters 
            "extract_rules": extract_rules,
            "js_scenario": js_scenario,
 # accesses the site via a proxy server in the US
            'country_code':'us'
        },
 # informs the API to automatically retry the request up to three times if it fails
        retries=3
    )

Note: Amazon is one of the biggest retailers in the world that is notoriously difficult to scrape. The only way to reach a product without logging into an account requires a product's ASIN code.

Our robust API makes it simple to scrape dynamic websites like Amazon, where reviews are often loaded with JavaScript and products can only be targeted reliably using their ASIN.

Extract Amazon Reviews Using Python

Now all what is left is to close the "amazon_reviews" function by printing out results and an HTTP status code to keep an eye on potential errors. After that, we close the function definition and invoke the function in the last line:

    results = response.json().get('properties', [])
    print(response.status_code)
    print(results)
# def amazon_reviews ends here. Next line invokes the function
amazon_reviews()

After running the code, the terminal prints out an HTTP error code and successful extraction of review data:

CMD

Now of course, looking at review details on a terminal won't attribute to any actionable insights. It's time to utilize the Pandas library, to transform the extracted review lists into a Pandas data frame, and then export it as a csv file:

#add these 2 lines before print(response.status_code) 
    df = pd.DataFrame(results)
    df.to_csv("result.csv", index=False)

By opening this new file in Google sheets, we can already see a big difference in how scraping data is presented:

Table

By defining detection of review elements in a extract_rules variable, your web scraping tool will take care of targeting correct class name variables on e-commerce platforms without additional Python libraries.

Extracting information from the Amazon website is not easy, as the platform covers a lot of publicly available data behind sign ups and logins. While this tutorial covers reviews for specific products, we highly recommend checking out our blog on scraping Amazon product data.

Handle Pagination for More Reviews

Of course, tracking reviews on only one specific product will not help us build a better understanding of customer feedback. Let's modify the script to include a "for" loop, which will go through the list of ASIN values in the same product category.

First, change the main function definition to accept a variable "asins". Then we expanded the "extract_rules" dictionary to include the CSS selector for the product title before showing review data.

def amazon_reviews(asins):

    extract_rules = {
        "product_title": {
            "selector":"span.a-size-large.product-title-word-break",
            "output":"text"
        },
        "properties": {
            "selector": "#cm-cr-dp-review-list > li",
            "type": "list",
            "output": {
                 "name": ".a-profile-name",
                 "rating": ".review-rating > span",
                 "date": ".review-date",
                 "title": ".review-title span:not([class])",
                 "content": ".review-text"
            }
        }
    }

Then, create an empty list variable that will contain all the reviews. From this point onward, the rest of the function will be in a "for" loop that delivers GET API requests to multiple product pages.

all_reviews = []

    for asin in asins:
        response = client.get(
            f'https://www.amazon.com/dp/{asin}',
            params={ 
                "extract_rules": extract_rules,
                "js_scenario": js_scenario,
                "country_code": "us"
            },
            retries=2
        )

Because our data frame has 5 columns, for a product title to appear before the review data, it has to be formatted in the same way. Let's transform the "product_title" variable so it can get appended before showing reviews.

        product_title=response.json().get('product_title')
#reformats title_entry in the same way as exported Amazon review data
        title_entry = {
        "name": product_title,
        "rating": "",
        "date": "",
        "title":"",
        "content": ""
        }

        all_reviews.append(title_entry)

Then, extract product properties in the same way as before, and extend the "all_reviews" variable with its data. We also included a quick print line to inform users on the HTTP status code for error handling, and the amount of reviews extracted from a specific product page.

 reviews = response.json().get('properties', [])
        all_reviews.extend(reviews)
    
        print(f"{asin}: {response.status_code}, {len(reviews)} reviews extracted")

Close off the updated function by assigning the all_reviews variable to the data frame, that will be exported in a csv format.

    df = pd.DataFrame(all_reviews)
    df.to_csv("all_reviews.csv", index=False)

Now, all what is left is to close the function and provide a list of product ASINs and provide them to the function to export reviews from multiple sources at the same time.

# Example usage
asin_list = ["B0CTH2QF23", "B0CCDTPDTQ","B099WTN2TR"]
amazon_reviews(asin_list)

Note: In this example, we chose 3 different kinds of floor lamps, forcing our web scraping tool to gather all the reviews. If you need help reaching real-time data on Amazon, check out our blog on how find all URLs on a domain's website.

Once everything is in place, your script should extract names and product details in a structured format. It should look something like this:

Table

Scraping Options Overview: Why ScrapingBee Works Best

Scraping Amazon reviews traditionally requires handling browser automation tools like Selenium or Puppeteer, managing proxies, and coding complex logic to render JavaScript. These methods are resource-intensive and often get blocked.

ScrapingBee eliminates all that complexity. Our API handles rotating proxies, geo-targeting, and JavaScript rendering out of the box. With just a few lines of code, you can collect clean, structured data from Amazon product pages without worrying about being blocked or detected.

This simplicity is what makes our tools perfect for beginners and professionals alike. There's no need to launch headless browsers because everything is managed server-side, letting you focus on your data, and not stress over the web scraper's infrastructure.

Whether you're scraping one ASIN or a hundred, we will help you scale quickly while maintaining speed and accuracy. It’s the most efficient path to Amazon review scraping!

Why Scraping Amazon Reviews is Useful

Amazon reviews are a rich source of real-world feedback on products. By scraping these reviews, you can gain valuable insights into customer sentiment, recurring complaints, and feature popularity. Whether you're a seller analyzing your own listings or a researcher comparing competitors, review data can uncover trends that influence product strategy and marketing decisions.

It's also helpful for academic research, price tracking, brand monitoring, and UX feedback. Scraping reviews gives you direct access to customer opinions — unfiltered, unprompted, and full of context.

What You Can Do With the Data

Here are a few ways you can benefit from tracking product ratings, especially for business use and market research:

  • Analyze sentiment to measure satisfaction

  • Compare ratings across products

  • Spot common complaints or highlights

  • Monitor feedback trends over time

  • Build dashboards or word clouds

  • Improve products and marketing based on real reviews

While web scraping is legal we encourage structuring your Amazon Reviews scraper. Avoid overloading their servers and stick to reasonable request rates to implement retry logic and mimic human behavior when accessing.

Also, do not use your scrapers to extract "logged-in" content. For extra security, we highly recommend masking connection requests with proxies to avoid detection, which are applied by default to our GET API calls.

Scrape Smarter With ScrapingBee

Scraping Amazon reviews doesn't have to be hard. ScrapingBee handles proxies, headless browsers, and JavaScript rendering so you don't have to. With our API, you can collect reviews at scale using a clean and simple Python script — no blockers, no noise.

Head over to the ScrapingBee Homepage and start your free trial. It will let you use the 1,000 API credits to build your own scraper in minutes, or copy our pre-built code to start scraping immediately.

Frequently Asked Questions (FAQs)

Can I scrape Amazon reviews without getting blocked?

Yes. Our HTML API automatically manages proxies and headers to avoid blocks, even from JavaScript-heavy pages like Amazon reviews.

Do I need a headless browser to scrape Amazon?

Yes, but not if you're using our tools! ScrapingBee has built-in JavaScript rendering, so you don't need to use or maintain a headless browser like Puppeteer or Selenium.

How many reviews can I scrape from Amazon?

You can scrape as many Amazon reviews as you need. Just provide your list of ASIN codes to the list at the end of the script and it will target each page and its reviews, as long as you stay within rate limits.

Can I use this method for different Amazon countries (e.g., UK, DE)?

Yes. Simply set the country_code parameter in your API request (e.g., "country_code": "de" for Germany). If that does not work out, adjust the URL within the GET API call to target a specific Amazon location.

image description
Kevin Sahin

Kevin worked in the web scraping industry for 10 years before co-founding ScrapingBee. He is also the author of the Java Web Scraping Handbook.