In this example, we’ll demonstrate how to leverage our AI Scraping API to extract key details from a real estate website.

Requirements

  • MrScraper console account.
  • MrScraper API token that you can get by following the steps here.

Real Estate Example

In this example, we’ll retrieve real-estate data from Zillow, returning results based on the defined schema.

Follow the steps below to use our AI Scraper API to extract Zillow data:

  1. 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.zillow.com/san-francisco-ca/"
    ],
    "min": 100,
    "max": 200,
    "timeout": 180,
    "schema": {
        "type": "array",
        "description": "List of properties",
        "items": {
            "type": "object",
            "description": "property information",
            "properties": {
                "property_address": {
                    "type": "string",
                    "description": "property address"
                },
                "property_price": {
                    "type": "number",
                    "description": "property price"
                },
                "property_url": {
                    "type": "string",
                    "description": "property valid image url"
                },
                "property_image_url": {
                    "type": "string",
                    "description": "property valid image url"
                },
                "property_price_currency": {
                    "type": "string",
                    "description": "the currency of the property price"
                },
                "property_location": {
                    "type": "string",
                    "description": "property location"
                }
            },
            "required": [
                "property_address",
                "property_price",
                "property_url",
                "property_image_url",
                "property_price_currency",
                "property_location"
            ]
        },
        "required": [
            "property"
        ]
    }
}'
  1. Replace Authorization with your API token and Set the URL to the Zillow.
  2. The above request body will return the following JSON response:
{
    "result": [
        {
            "property_address": "874 Dartmouth St, San Francisco, CA 94134",
            "property_price": 798000,
            "property_url": "https://www.zillow.com/homedetails/874-Dartmouth-St-San-Francisco-CA-94134/15172150_zpid/",
            "property_image_url": "https://photos.zillowstatic.com/fp/7986b00d44dd9fdbfa2934b0a172828a-p_e.jpg",
            "property_price_currency": "USD",
            "property_location": "San Francisco, CA"
        },
        {
            "property_address": "737 Paris St, San Francisco, CA 94112",
            "property_price": 1099000,
            "property_url": "https://www.zillow.com/homedetails/737-Paris-St-San-Francisco-CA-94112/15176533_zpid/",
            "property_image_url": "https://photos.zillowstatic.com/fp/df579287528766243825bf4316637c70-p_e.jpg",
            "property_price_currency": "USD",
            "property_location": "San Francisco, CA"
        }
    ],
    "tokenUsage": 4,
    "totalDone": 1
}