Search public Romanian real estate listings, read details and compare locally observed asking prices. This unofficial client uses anonymous HTTPS GETs.
From the checkout on Linux or macOS with Python 3.10 or later:
git clone https://github.com/mihailmariusiondev/olx-cli.git && cd olx-cli
python3 -m pip install .With uv, use uv tool install . for an isolated
installation. Run olx doctor --json to see the installed version and
olx selftest to check the packaged fixture reads.
olx search --county Cluj --city Cluj-Napoca --deal rent --limit 3 --json
olx search --county Cluj --deal rent --sort price-asc --posted-since 7d
olx detail "$OLX_LISTING_URL" --format jsonl
olx snapshot --county Cluj --city Cluj-Napoca --json
olx diff --format csv
olx history "$OLX_LISTING_ID" --format jsonlTake the URL and numeric ID from a search result. Search defaults to apartment
sales and up to 40 matches. Use --county for ambiguous town names.
The site sometimes requires its exact slug_ID for a town. OLX has one land
category, available as --property land.
Search uses OLX's requested sort order, which can still show promoted rows
first. --posted-since applies a local filter on the first-published date.
--cursor takes data.next_cursor with the original filters. --all
deduplicates across pages in one run. Check data.site_capped and
data.metrics.site_visible_count before treating an export as exhaustive.
--details fetches one eligible detail page per row.
Price bounds use each listing's displayed amount. Add --currency to compare
one currency. The source payload's converted price, when available, appears
separately as site_regular_price and site_regular_currency. --rooms 4
includes the site's four-or-more category. The agency filter uses OLX's
business-seller flag.
A snapshot saves fresh, complete results in one local SQLite transaction.
A failed, blocked or capped search leaves the previous history intact.
diff compares consecutive snapshots with the same filters and history
reads local observations. Both work offline.
Environment variables override config at
${XDG_CONFIG_HOME:-~/.config}/olx-cli/config. Copy config.example
there to set cache lifetime. Use --max-age to override it for one command.
OLX_MIN_INTERVAL raises the minimum request interval. Cache, cooldown and
history use the XDG cache, state and data directories.
olx doctor --json is offline. olx doctor --live --json reads robots.txt.
The client checks route scope and robots policy on each request, including
redirects. On exit 5, use offline doctor to check policy and cooldown.
--json writes an envelope with schema_version (2), ok, outcome,
exit_code, data, and error. --format jsonl or --format csv writes
rows. CSV serializes nested values as JSON. Import untrusted listing text
as text in spreadsheets. Search, detail and snapshot write export metrics to
stderr. Rows carry a source URL and retrieval time.
Required field failures exit 4 with the command and field path. Missing or
malformed optional fields produce warnings while valid fields stay available.
--soft-drift remains accepted for compatibility. drift inspects bundled
fixtures offline. drift --live checks one public search page and one detail
page. raw accepts the supported public read routes on OLX.ro.
- 0 — Success, empty search, missing listing or no prior snapshot
- 1 — Local filesystem or database failure
- 2 — Invalid usage
- 3 — Upstream session required
- 4 — Upstream or response shape failure
- 5 — Access block, cooldown or robots refusal
Run olx COMMAND --help for flag descriptions.
usage: olx [-h] [--json] [--format {jsonl,csv}]
{search,detail,snapshot,diff,history,raw,doctor,drift,selftest} ...
search — find OLX listings; use --surface-min and --surface-max for area in square metres
usage: olx search [-h] [--json] [--fresh] [--soft-drift] [--max-age SECONDS] [--format
{jsonl,csv}] [--deal {sale,rent}] [--property {apartment,house,land}] [--county COUNTY]
[--city CITY] [--price-min PRICE_MIN] [--price-max PRICE_MAX] [--surface-min
SURFACE_MIN] [--surface-max SURFACE_MAX] [--currency {EUR,RON}] [--rooms ROOMS]
[--floor FLOOR] [--seller {private,agency}] [--limit LIMIT | --all] [--cursor CURSOR]
[--details] [--sort {price-asc,price-desc,newest}] [--posted-since DATE|Nd]
detail — read a public listing by URL
usage: olx detail [-h] [--json] [--fresh] [--soft-drift] [--max-age SECONDS] [--format
{jsonl,csv}] url
snapshot — record a complete search in the local SQLite database
usage: olx snapshot [-h] [--json] [--fresh] [--soft-drift] [--max-age SECONDS] [--format
{jsonl,csv}] [--deal {sale,rent}] [--property {apartment,house,land}] [--county COUNTY]
[--city CITY] [--price-min PRICE_MIN] [--price-max PRICE_MAX] [--surface-min
SURFACE_MIN] [--surface-max SURFACE_MAX] [--currency {EUR,RON}] [--rooms ROOMS]
[--floor FLOOR] [--seller {private,agency}]
diff — compare a local snapshot with the previous one for the same search
usage: olx diff [-h] [--json] [--format {jsonl,csv}] [--snapshot-id SNAPSHOT_ID]
history — show all local price observations for one numeric listing ID
usage: olx history [-h] [--json] [--format {jsonl,csv}] listing_id
raw — GET the original body of an allowed OLX real estate page
usage: olx raw [-h] [--json] [--fresh] [--soft-drift] [--max-age SECONDS] url
doctor — inspect local configuration, robots.txt and HTTP state
usage: olx doctor [-h] [--json] [--max-age SECONDS] [--live]
drift — check packaged page shapes and optionally verify against OLX
usage: olx drift [-h] [--json] [--soft-drift] [--max-age SECONDS] [--live]
selftest — exercise read commands on fixtures or on public OLX pages
usage: olx selftest [-h] [--json] [--live]
uv sync --locked
uv run --locked pytest
uv run --locked python scripts/command-inventory.py --checkUpdate the command reference with uv run --locked python scripts/command-inventory.py.
The tests disable sockets. olx selftest --live performs paced public reads
and uses a temporary history database.
See the changelog, MIT license and security reporting instructions.