In this example, we’ll demonstrate how to leverage our AI Scraping API to extract key details from an e-commerce.
Requirements
- MrScraper console account.
- MrScraper API token that you can get by following the steps here.
E-commerce Example
In this example, we’ll retrieve e-commerce data from eBay, returning results based on the defined schema.
Follow the steps below to use our AI Scraper API to extract eBay data:
- Use the request body below:
curl --location 'https://app.mrscraper.com/api/ai' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_TOKEN' \
--data '{
"urls": [
"https://www.ebay.com/sch/i.html?_from=R40&_trksid=p4432023.m570.l1313&_nkw=shoes&_sacat=0"
],
"min": 100,
"max": 200,
"timeout": 180,
"schema": {
"type": "array",
"description": "List of products",
"items": {
"type": "object",
"description": "product information",
"properties": {
"product_name": {
"type": "string",
"description": "product name"
},
"product_url": {
"type": "string",
"description": "product valid url"
},
"product_sold": {
"type": "number",
"description": "total product sold"
},
"product_price": {
"type": "number",
"description": "product price"
},
"product_currency": {
"type": "string",
"description": "the currency of the product price"
},
"product_location": {
"type": "string",
"description": "product location"
}
},
"required": [
"product_name",
"product_url",
"product_sold",
"product_price",
"product_currency",
"product_location"
]
},
"required": [
"products"
]
}
}'
- Replace Authorization with your API token and Set the URL to the eBay.
- The above request body will return the following JSON response:
{
"result": [
{
"product_name": "Ellie Shoes E-557-Eden-G 5\" Chunky Heel Glitter Women's Costume Mary Jane Pump",
"product_url": "https://www.ebay.com/itm/175233495921?_skw=shoes&itmmeta=01J8VK873NNDH1E2QV831JD9EV&hash=item28ccbaf371%3Ag%3A1SIAAOSww2NlRQmP&itmprp=enc%3AAQAJAAAAwHoV3kP08IDx%2BKZ9MfhVJKlw8xMMcCQ1aqLGUZiclw9pyA4VI7H%2Bpi0S9MiJuh200wL2iqccUsz%2Fmu6OKWb%2Fm8d8dFpyOzy6AVwVWSWHbX8AZ4CWRCJsbHWB%2FU%2FR%2BcAar6zQHvuYSpevG%2F7w2X3RZa%2BVnT10rVRxmdFNP4WxaT21pG36gmOhbc%2FdEpFr3lfUV9qZnr9TxW2EmlE52NnjcxVATuIm57t2MYrHrl35bvi12AIlTCyxCp7NttsWBga4gQ%3D%3D%7Ctkp%3ABlBMUPTxoPPGZA",
"product_sold": 100,
"product_price": 63,
"product_currency": "USD",
"product_location": "United States"
},
{
"product_name": "PUMA Men's Tazon 6 Fracture FM Wide Sneakers",
"product_url": "https://www.ebay.com/itm/276264479938?_skw=shoes&epid=15064570300&itmmeta=01J8VK873P95CJX960QCTAWDYG&hash=item4052a56cc2%3Ag%3AcDcAAOSwflJllkL1&itmprp=enc%3AAQAJAAAA4HoV3kP08IDx%2BKZ9MfhVJKmM3XypkOV6cQpxTQpwCUBWpnoFf0ebT%2BdtJn5zyac25A%2FpID0mN0XA%2FXFqrRJaA5PSPQkDIQsWtpYoCPgI1ujXwUIKS6ISdWJBjl7t2AHAoRajvtbZSwv9nQLyvSJfhkudMvmluYMUgWl3vS3RdWvmOVOAknAl66A0i3x609QjT8wLMy6be3233zljaKEH7VhAREnEusVuZMLfTmtbNihltDGMexJ3SX2%2FbLhSnSzXGQ%3D%3D%7Ctkp%3ABk9SR_rxoPPGZA&var=578652955733",
"product_sold": 60,
"product_price": 30.99,
"product_currency": "USD",
"product_location": "United States"
}
],
"tokenUsage": 11,
"totalDone": 1
}