How to Scrape Wayfair Product Data (2025 Guide)
Wayfair is one of the largest online retailers of furniture and home goods. If you're looking to scrape product data such as titles, prices, ratings, and reviews for market analysis or price monitoring, you're in the right place.
In this guide, we’ll go through:
- How Wayfair’s URLs work
- How to bypass dynamic pages using keyword-based search URLs
- A complete scraping pipeline with Python and BeautifulSoup
- Extracting product details: title, price, ratings, reviews, and links
- Saving your results to CSV
Understanding Wayfair’s URL Structure
Wayfair centralizes navigation for all its product categories using the main index:
Central Index Page
Wayfair organizes categories using this dynamic index page:
https://www.wayfair.com/shop/o/pt/index
This page includes links to every product category such as sofas, beds, lighting, decor, kitchen, and more.
Then the page loads all product categories and helps route users to dynamic pages when they search for something. For example, searching "blender" might take you to:
https://www.wayfair.com/kitchen-tabletop/sb0/blenders-c419247.html?redir=blender&rtype=9
Even though it looks like a clean category page but that makes it hard to scrape with simple tools like requests and BeautifulSoup.
How to Use the keyword.php Search Endpoint
Instead of scraping the dynamic category URL, you can use Wayfair's search-friendly HTML version:
https://www.wayfair.com/keyword.php?keyword=blender
This loads the same products but in plain HTML, so it's much easier to scrape.
Paginate Using curpage
To access more results, add the curpage parameter to the URL. This tells Wayfair which page of search results you want to see.
Example Search URLs:
Page 1:
https://www.wayfair.com/keyword.php?keyword=blender&curpage=1
Page 2:
https://www.wayfair.com/keyword.php?keyword=blender&curpage=2
You can replace blender with any other search term and keep increasing curpage to get more results.
This search URL structure returns HTML directly and is best for basic scraping scripts.
Step-by-Step Scraping Wayfair Product Data with Python and BeautifulSoup
We’ll now go through how to build wayfair scraper in Python.
Step 1: Install Required Libraries
Before we start, ensure you have the necessary Python libraries installed. You can install them via pip using the following command:
-
requests: Used to make HTTP requests and fetch page content.
-
beautifulsoup4: A Python library to parse and extract information from HTML.
After installing required libraries, import them.
2. Define Headers and Base URLs
These headers help simulate a browser request, which is often necessary to avoid being blocked by the site. The BASE_URL
is used to construct the search request, while WAYFAIR_DOMAIN
is used to construct full product URLs from relative links.
3. Extract Star Rating from Inline CSS
Wayfair encodes star ratings in inline CSS using a percentage width. For example, a 100% width corresponds to a 5-star rating. This function converts that width into a 0 to 5 scale by dividing by 20.
4. Scrape Product Listings from Search Pages
This function takes a keyword and the number of result pages to scrape. It constructs a GET request using the search query and curpage to paginate through results.
If the request fails, the function stops and reports the HTTP status code.
Parses the HTML content using BeautifulSoup for easier element selection.
These selectors locate product data within the HTML structure based on data-test-id
or data-enzyme-id
attributes.
If no product titles are found, it assumes the end of results and exits.
For each product, this block extracts the text content and constructs the product URL. It ensures the data is available before accessing it, using if conditions and fallback values like "N/A".
Moves to the next page and waits a random time between 1.5 and 2.5 seconds to avoid overwhelming the server.
After scraping all pages, the function returns a list of product dictionaries.
5. Save Scraped Data to CSV
This function writes the list of product dictionaries to a CSV file. It includes column headers and uses UTF-8 encoding to handle special characters.
6. Execute Full Scraping Flow
This is the main execution block. If the script is run directly, it will scrape two pages of "blender" products and save the data to a CSV file.
Wayfair's structure may change over time. The HTML selectors used in this guide are based on the current (2025 April) version of the site.
Always inspect the live page and update your parser logic if elements or classes change.
What’s Next: Scrape Individual Product Pages
Once you’ve collected the product listing URLs, you can extend this scraper to visit each product detail page and extract deeper information such as specifications, dimensions, images, and availability.
Each product URL returned in the listing can be parsed with a similar approach using requests and BeautifulSoup.
Need a Simpler Solution? Use Unwrangle API for Wayfair
Manually scraping Wayfair can be tricky and time-consuming due to the complexity of their pages. Unwrangle APIs offer an easy alternative to gather data from Wayfair without dealing with scrapers or anti-bot defenses.
Wayfair Search API | Wayfair Product Data API | Wayfair Category Search API
-
Retrieve Product Details: Access product information such as titles, prices, images, and descriptions directly through the API.
-
Fetch Category Data: Easily search and retrieve product listings from specific categories.
-
Structured JSON Responses: Get clean and structured data in JSON format to making it simple to integrate into your applications or analytics tools.