# Olx Scraper (`hello.datawizard-owner/olx-scraper`)

The OLX Scraper is an Apify actor designed to extract detailed data from olx.com. Customize inputs like item limit, price range, and search query. Get comprehensive JSON outputs with listing details, images, prices, and more. Ideal for precise and efficient data scraping.

- **URL**: https://beta-securitybyobscurity.apify.com/hello.datawizard-owner/olx-scraper.md
- **Developed by:** [datawizards](https://beta-securitybyobscurity.apify.com/hello.datawizard-owner) (community)
- **Categories:** Automation, Real estate, E-commerce
- **Stats:** 136 total users, 25 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.
You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

# README

## OLX Scraper Documentation

### Overview

The OLX Scraper is an Apify actor designed to scrape detailed information from [olx.com](https://www.olx.com). This tool is ideal for users looking to extract data about specific items, such as mobile phones, within specified price ranges and other parameters.

### Input Configuration

The scraper accepts the following JSON input:

```json
{
  "item_limit": 10,
  "price_max": 50000,
  "price_min": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "query": "mobile phone"
}
```

#### Input Fields

- **item\_limit**: *(Number)* The maximum number of items to scrape. Default is 10.
- **price\_max**: *(Number)* The upper limit for the price filter. Only items priced below or equal to this value will be retrieved.
- **price\_min**: *(Number)* The lower limit for the price filter. Only items priced above or equal to this value will be retrieved.
- **proxyConfiguration**: *(Object)* Configuration for proxy usage. Set `useApifyProxy` to `true` to use the Apify Proxy, or `false` to disable it.
- **query**: *(String)* The search keyword or phrase to look for (e.g., "mobile phone").

### Output Format

The actor returns results in the following JSON structure:

```json
[
    {
        "id": "1792974206",
        "title": "Taj Mobiles Seconds Mobile Available in Best Price Indira nagar",
        "body_type": null,
        "user_type": "Regular",
        "image": [
            "https://apollo.olx.in:443/v1/files/9eedd4arefq02-IN/image",
            "https://apollo.olx.in:443/v1/files/5oav3992np342-IN/image",
            "https://apollo.olx.in:443/v1/files/1uemrs5d63le1-IN/image",
            "https://apollo.olx.in:443/v1/files/2s1iveb7b2bi1-IN/image",
            "https://apollo.olx.in:443/v1/files/wj46j39m37od1-IN/image"
        ],
        "price": {
            "value": {
                "raw": 7000,
                "currency": {
                    "iso_4217": "INR",
                    "pre": "₹"
                },
                "display": "₹ 7,000"
            },
            "key_name": "Price",
            "key": "price"
        },
        "location": "Karnataka",
        "description": "All Android Models Available in Best Price\nAnd I phone's Available.\nWe buy Mobile an sale.\nNo refurbished mobiles.\nBest offer's will provide \nShop Name Taj mobile world Indira Nagar \nBangalore.",
        "created_at": "2024-12-17T19:25:57+05:30",
        "certified": false,
        "kyc_verified_user": false,
        "KM_run": null,
        "parameters": [
            {
                "type": "single",
                "key": "make",
                "value_name": "Vivo",
                "value": "vivo-phone",
                "key_name": "Brand",
                "formatted_value": "Vivo"
            }
        ]
    }
]
```

#### Output Fields

- **id**: *(String)* Unique identifier for the listing.
- **title**: *(String)* Title of the listing.
- **body\_type**: *(String)* Type of body (if applicable).
- **user\_type**: *(String)* Type of user posting the ad (e.g., Regular, Dealer).
- **image**: *(Array)* URLs of images associated with the listing.
- **price**: *(Object)* Details about the price, including currency and display format.
- **location**: *(String)* Location of the listing.
- **description**: *(String)* Description of the listing.
- **created\_at**: *(String)* Date and time when the listing was created.
- **certified**: *(Boolean)* Indicates if the listing is certified.
- **kyc\_verified\_user**: *(Boolean)* Indicates if the user is KYC-verified.
- **KM\_run**: *(Number)* Kilometers run (if applicable).
- **parameters**: *(Array)* Additional parameters such as brand or model.

### Support

For customized outputs or bug reports, please contact us at <hello.datawizard@gmail.com>. When reaching out, ensure the subject line specifies the nature of your request (e.g., "Custom Output Request" or "Bug Report").

Thank you for using the OLX Scraper!

# Actor input Schema

## `query` (type: `string`):

The query term to search for. This will be used if 'startUrls' is not provided.

## `price_min` (type: `integer`):

The minimum price of items to scrape.

## `price_max` (type: `integer`):

The maximum price of items to scrape.

## `item_limit` (type: `integer`):

The maximum number of items to scrape.

## `proxyConfiguration` (type: `object`):

Specifies proxy servers that will be used by the scraper in order to hide its origin.

## Actor input object example

```json
{
  "query": "mobile phone",
  "price_min": 50,
  "price_max": 50000,
  "item_limit": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "mobile phone",
    "price_min": 50,
    "price_max": 50000,
    "item_limit": 100,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("hello.datawizard-owner/olx-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "mobile phone",
    "price_min": 50,
    "price_max": 50000,
    "item_limit": 100,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("hello.datawizard-owner/olx-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "mobile phone",
  "price_min": 50,
  "price_max": 50000,
  "item_limit": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call hello.datawizard-owner/olx-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=hello.datawizard-owner/olx-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Olx Scraper",
        "description": "The OLX Scraper is an Apify actor designed to extract detailed data from olx.com. Customize inputs like item limit, price range, and search query. Get comprehensive JSON outputs with listing details, images, prices, and more. Ideal for precise and efficient data scraping.",
        "version": "0.0",
        "x-build-id": "jUHopmVM7RzaSi7P2"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hello.datawizard-owner~olx-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hello.datawizard-owner-olx-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/hello.datawizard-owner~olx-scraper/runs": {
            "post": {
                "operationId": "runs-sync-hello.datawizard-owner-olx-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/hello.datawizard-owner~olx-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-hello.datawizard-owner-olx-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "The query term to search for. This will be used if 'startUrls' is not provided.",
                        "default": "mobile phone"
                    },
                    "price_min": {
                        "title": "Minimum Price",
                        "type": "integer",
                        "description": "The minimum price of items to scrape.",
                        "default": 50
                    },
                    "price_max": {
                        "title": "Maximum Price",
                        "type": "integer",
                        "description": "The maximum price of items to scrape.",
                        "default": 50000
                    },
                    "item_limit": {
                        "title": "Item Limit",
                        "type": "integer",
                        "description": "The maximum number of items to scrape.",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Specifies proxy servers that will be used by the scraper in order to hide its origin.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
