Web scraping online shops like eBay and Amazon has become a critically important data source, allowing you to conveniently compare hot-sale products from prices, features, and product descriptions.
This tutorial will show you how to scrape product data from eBay.
You can go to Task Template on the main screen of the Octoparse scraping tool and start with the ready-to-use eBay Templates directly to save you time. With this feature, there is no need to configure scraping tasks. For further details, you may check it out here: Task Templates
If you would like to know how to build the task from scratch, you may continue reading the following tutorial. We will scrape data such as the name, condition, price, and more info from the product details page with Octoparse.
To follow through, you may want to use this URL in the tutorial:
We are going to scrape the product information of the "digital camera" on eBay. Check out the main steps in the menu on the right. [Download task file]
1. Create a Go To Web Page - to open the target web page
Enter the example URL and click Start
2. Auto-detect web page data - to create the workflow
Click Auto-detect web page data and wait for the detection to complete
Delete any unwanted fields
Uncheck Add a page scroll
Choose Create workflow on the Tips panel
You will now get the workflow below.
If all the data you need can be scraped from the listing page, you can stop here and jump to Start extraction - run the task and get the data. If you want to go to each product detail page to get more info, follow the steps below.
3. Select the link - to scrape data from the detail page
Choose Select subpage URL
Choose Title_URL from the drop-down option
Choose Confirm
Octoparse will automatically go to the first product detail page.
4. Extract data - to collect data from the product detail page
Click on any element(s) you want and choose Text
Double-click on the field name to rename it if needed
Tip: Check the following tutorials for what kind of data you can scrape:
5. Modify the XPath of the data fields - to scrape the data precisely
You may need to modify the XPath of some data fields that do not show on every product page, or the field position varies from page to page, like MPN or UPC. We can modify the XPath to make the data scraping more precise. No worries! We have prepared some frequently-used XPaths for you. You can just use the element XPath provided below.
Click More
Click on Customize XPath
Replace the XPath with the revised one
MPN: //span[text()='MPN']/ancestor::dl/dd
UPC: //span[text()='UPC']/../../../../div[2]/div
Item Weight: //span[text()='Item Weight']/../../../../div[2]//span
Add a backup Xpath:
MPN: //div[text()='MPN']/../div[2]
UPC: //div[text()='UPC']/../div[2]
Item Weight: //div[text()='Item Weight']/../div[2]
Click Apply to save
Tip: You can check the XPath tutorials below to write XPaths for other fields if needed:
The final workflow should look like this:
6. Start extraction - to run the task and get the data
Click Save
Click Run on the upper left side
Select Run on your device, or select Run in the Cloud (for premium users only)
Here is the sample output.