E-commerce data scraping is a common practice driven by several key reasons. It enables businesses to conduct market research, monitor prices, enhance product catalogs, generate leads, and aggregate content. In this tutorial, you'll learn more about e-commerce web scraping by using Python and Oxylabs’ Web Scraper API. This e-commerce scraping tool will help you avoid any antibot protection or CAPTCHA without writing a complex script.
For your convenience, we also prepared this tutorial in a video format:
Let’s get started.
First, you’ll have to install Python. Please download it from here.
Next, you’ll have to install a couple of libraries so that you can interact with our e-commerce product scraper and parse the HTML content. You can run the below command:
pip install bs4 requestsThis will install Beautiful Soup and the requests libraries for you.
Now, you can import these libraries using the following code:
from bs4 import BeautifulSoup
import requestsNext, you’ll have to log in to your Oxylabs E-Commerce Scraper API account to retrieve API credentials. If you don’t have an account yet, you can simply sign up for a free trial. There, you’ll get the necessary credentials for the e-commerce scraper.
Once you've retrieved your credentials, you can add them to your code.
username, password = 'USERNAME', 'PASSWORD'Don’t forget to replace USERNAME and PASSWORD with your username and password.
Oxylabs’ Web Scraper API expects a JSON payload in a POST request. You’ll have to prepare the payload before sending the POST request. The source must be set to universal.
url = "https://sandbox.oxylabs.io/products"
payload = {
'source': 'universal',
'render': 'html',
'url': url,
}’render’: 'html' tells the API to execute JavaScript when loading the website content.
Note: For demonstration, we’ll scrape e-commerce data from the sandbox.oxylabs.io store page.
Let’s send the payload using the requests module’s `post()` method. You can pass the credentials using the `auth` parameter.
response = requests.post(
'https://realtime.oxylabs.io/v1/queries',
auth=(username, password),
json=payload,
)
print(response.status_code)Since the `payload` needs to be in JSON format, you can use the `json` parameter of the `post()` method. If you run this code now, you should see the output of the `status_code` as `200`. Any other numbers mean there are some errors, if you get one, check your credentials, payload, and URL thoroughly and make sure they all are correct.
You can extract the HTML content from the `JSON` response of the API and create a Beautiful Soup object named `soup`.
content = response.json()["results"][0]["content"]
soup = BeautifulSoup(content, "html.parser")Using Web Browser’s developer tools, you can inspect the various elements of the website to find the necessary CSS selectors. Once you've gathered the CSS selectors, you can use the `soup` object to extract those elements. To activate the developer tools, you can simply browse to the target website, right-click, and select inspect. Let’s parse the title, price, and availability of all products.
If you inspect the title, you’ll notice it’s inside a `<h4>` tag with a class `title`.

So, you can use the `soup` object to extract the title as below:
title = soup.find('h4', {"class": "title"}).get_text(strip=True)Similarly, inspect the price element.

As you can see, it’s wrapped in a <div> with the class price-wrapper. So, use the find() method, as shown below, to extract the price text.
price = soup.find('div', {"class": "price-wrapper"}).get_text(strip=True)There are two types of availability on this website, In Stock and Out of Stock. If you inspect both elements, you’ll notice they have different classes.

Fortunately, the Beautiful Soup library’s find() method supports multiple class lookups. You’ll have to pass the classes in a list object.
availability = soup.find('p', {"class": ["in-stock", "out-of-stock"]}).get_text(strip=True)For more efficient scraping, take a look at the best practices of how to use find() & find_all() in BeautifulSoup.
To extract all product data, you’ll have to inspect the product elements and find the appropriate CSS selectors.

Since each of the product elements is wrapped in a <div> with class product-card, you can loop through each element using a for loop.
data = []
for elem in soup.find_all("div", {"class": "product-card"}):
title = elem.find('h4', {"class": "title"}).get_text(strip=True)
price = elem.find('div', {"class": "price-wrapper"}).get_text(strip=True)
availability = elem.find('p', {"class": ["in-stock", "out-of-stock"]}).get_text(strip=True)
data.append({
"title": title,
"price": price,
"availability": availability,
})
print(data)The data list will contain all the product data.
The entire e-commerce web scraper is given below for your convenience. You can use it as a building block for your next e-commerce website scraper. You’ll only have to replace the URL and parsing logic with your own.
from bs4 import BeautifulSoup
import requests
username, password = 'USERNAME', 'PASSWORD'
url = "https://sandbox.oxylabs.io/products"
payload = {
'source': 'universal',
'render': 'html',
'url': url,
}
response = requests.post(
'https://realtime.oxylabs.io/v1/queries',
auth=(username, password),
json=payload,
)
print(response.status_code)
content = response.json()["results"][0]["content"]
soup = BeautifulSoup(content, "html.parser")
data = []
for elem in soup.find_all("div", {"class": "product-card"}):
title = elem.find('h4', {"class": "title"}).get_text(strip=True)
price = elem.find('div', {"class": "price-wrapper"}).get_text(strip=True)
availability = elem.find('p', {"class": ["in-stock", "out-of-stock"]}).get_text(strip=True)
data.append({
"title": title,
"price": price,
"availability": availability,
})
print(data)Here’s the output:

So far, you’ve learned how to scrape data from e-commerce website using Python. You also explored Oxylabs’ Web Scraper API and learned how to use it for web scraping e-commerce websites with ease. By using the techniques described in this article, you can perform large-scale web scraping for e-commerce on websites with bot protection and CAPTCHA.
New to web scraping? Learn what is web scraping and how to scrape data on our blog.
If you'd like to scrape e-commerce data with Web Scraper API, we have various targets available that you can use to: scrape Amazon data, scrape 1688 data, scrape Google Shopping data, scrape eBay data, and more.
For e-commerce and product details data scraping, you’ll first need to pick a programming language you are most comfortable with. Python, Go, JavaScript, Ruby, and Elixir are popular programming languages with excellent support for large-scale e-commerce data scraping. After that, you’ll have to find the necessary tools and libraries available to help you extract data from the target website. You can learn the web scraping best practices here.
Web scraping is ethical as long as the scrapers respect all the rules set by the target websites, don’t harm the website, don’t breach any laws, and use the scraped data with good intentions. It’s essential to respect the ToS of the website and obey the rules of the robots.txt file. Read this article to learn more about ethical web scraping.
Choosing the right web scraping tool depends on your project’s scale, goals, and technical requirements. For example, Python offers great flexibility and is compatible with popular libraries like Selenium or Scrapy, which come with their own benefits and drawbacks: Selenium excels at handling dynamic, JavaScript-heavy pages, while Scrapy is better suited for large-scale, structured crawls. While some tools provide only basic scraping capabilities, others are built to manage more complex data extraction scenarios efficiently. Since it’s not always obvious whether a tool will meet your needs, it’s best to research and test different options before deciding on the right one.
Yes, Python is widely used for web scraping e-commerce sites because it offers excellent libraries like BeautifulSoup, Scrapy, and Selenium. These tools simplify the process of extracting product data, even from dynamic or JavaScript-heavy pages. Web scraping e-commerce websites using Python allows for scalable, efficient, and automated data collection.
With data scraping for e-commerce, you can collect a variety of product information, including titles, descriptions, prices, availability, images, and customer reviews. This data is often used to build price comparison tools, monitor competitors, or enhance internal analytics systems.
An e-commerce price scraper is a tool designed to extract product pricing data from online stores. It helps businesses track competitors’ price changes, identify market trends, or optimize their own pricing strategies. Python-based e-commerce price scrapers are especially popular due to their flexibility and extensive support libraries.
About the author

Maryia Stsiopkina
Former Senior Content Manager
Maryia Stsiopkina was a Senior Content Manager at Oxylabs. As her passion for writing was developing, she was writing either creepy detective stories or fairy tales at different points in time. Eventually, she found herself in the tech wonderland with numerous hidden corners to explore. At leisure, she does birdwatching with binoculars (some people mistake it for stalking), makes flower jewelry, and eats pickles.
All information on Oxylabs Blog is provided on an "as is" basis and for informational purposes only. We make no representation and disclaim all liability with respect to your use of any information contained on Oxylabs Blog or any third-party websites that may be linked therein. Before engaging in scraping activities of any kind you should consult your legal advisors and carefully read the particular website's terms of service or receive a scraping license.



Yelyzaveta Hayrapetyan
2025-10-17


Augustas Pelakauskas
2025-10-16
Try Web Scraper API
Choose Oxylabs' Web Scraper API to unlock real-time product data hassle-free.
Get the latest news from data gathering world
Scale up your business with Oxylabs®
Proxies
Advanced proxy solutions
Data Collection
Datasets
Resources
Innovation hub
Try Web Scraper API
Choose Oxylabs' Web Scraper API to unlock real-time product data hassle-free.