Skip to main content

olx-phone-scout: finds the best-value used phones on OLX.kz. Shown next to the title: the top entry of a real report, an iPhone 11 Pro Max 256GB for 80,000 KZT with its value factors

CI OpenSSF Scorecard License: MIT Python 3.12+
English · Русский

A command-line tool for anyone buying a used phone on OLX.kz. It reads every listing in your price range, works out the brand and model from messy titles, adds specs from Kimovil, compares the asking price with the model's market price and writes a ranked report. Built for Almaty, works for any OLX.kz region.

A real run of ./run.sh --min-price 150000 --max-price 160000: 396 listings scraped in about 3 seconds, 117 Android phones scored, top 5 printed with their discounts from market price (played at 2.5x speed)

A real run

The top of the report from ./run.sh --min-price 15000 --max-price 80000 --phone-type both --location alm (6,557 listings analyzed), trimmed:

📱 iPhone 11 Pro Max (iPhone 11 Pro Max 256GB Gold)
💰 PRICE: 80,000 KZT
📅 RELEASE YEAR: 2019
📍 LOCATION: Гульдала - 27 сентября 2026 г.
⚠️  📍 OUTSIDE АЛМАТЫ: Гульдала, you'll need to travel

⭐ VALUE FACTORS:
   ⭐⭐⭐ Ultra Flagship
   💾 Good 256GB storage
   ✨ Excellent condition
   🔋 Excellent battery (95%+)

What it does

  • Reads the whole price range. OLX returns at most 1000 results per search, so the range is split into price slices until each one fits under that cap. All pages are fetched concurrently, paced and retried.
  • Understands messy titles. 22 brands, Cyrillic spellings and common typos ("xioami", "techno", "poko", "z фолд"). Phones offered in exchange ("обмен на iphone 13") don't count as the phone for sale.
  • Adds specs from Kimovil. Screen, chipset, AnTuTu, battery, charging and DxOMark, cached in SQLite across runs.
  • Scores value. Discount from the market price (102 models), release year, tier, storage, RAM, camera and condition. Implausible discounts are capped, out-of-town listings and shops are flagged.
  • Optional AI pass. Gemini, Cerebras or OpenRouter read the description (and optionally the photos) for defects and extras. No API key needed for the rest of the pipeline.

How it differs

  • OLX's own search filters by price and sorts by date or price. It doesn't know what a model is worth, so a cheap old phone and a well-priced recent flagship look alike, and "xioami 14 512/16" is just a title.
  • Price comparison sites cover new phones in shops, not private used listings.
  • Generic scrapers give you raw listings. Brand detection, specs, scoring and getting past OLX's TLS fingerprint check are left to you.

How it works

Pipeline: scrape every listing in price slices, detect brand and model, then score value with Kimovil specs and market prices into the top 50 report

OLX and Kimovil both sit behind bot protection that checks the TLS fingerprint, not just headers. Requests go through curl_cffi impersonating Chrome, with pacing and retries from market-sources. Kimovil pages are parsed with selectolax; no browser is involved.

Architecture notes for contributors and coding agents are in CLAUDE.md.

Install

Needs Python 3.12+ and uv.

git clone https://github.com/octrow/olx-phone-scout.git
cd olx-phone-scout
uv sync

For the AI pass, copy .env.example to .env and fill in the key of the provider you use.

Run

./run.sh                    # full pipeline: scrape → recategorize → analyze
./run.sh --scrape           # scrape OLX only
./run.sh --recategorize     # re-run brand detection on saved listings
./run.sh --analyze          # analyze saved listings only
./run.sh --show-config      # print the configuration and exit

./run.sh is a thin wrapper around uv run main.py; the same flags work with either.

./run.sh --min-price 150000 --max-price 300000 --max-pages 10 --days-back 14
./run.sh --min-price 15000 --max-price 80000 --phone-type both   # Android + iPhone
./run.sh --location alm --include-business   # Almaty city + region, shops too (marked 📍 / 🏪)
./run.sh --gemini           # Gemini AI analysis (--gemini-photos, --gemini-top-n N)
./run.sh --cerebras         # or --openrouter

--location takes any OLX.kz region slug (astana, shymkent, karaganda, ...); see --help.

Output

Each run writes to a session folder named after its settings, e.g. data/sessions/alma-ata_90k-380k_android/:

  • results/: all_listings.json, androids.json, iphones.json, unknown.json, androids_analyzed.json, TOP_50_ANDROID.json
  • reports/TOP_RECOMMENDATIONS_{timestamp}.txt: the ranked, human-readable report
  • logs/: one log per pipeline step

Kimovil specs are cached for all sessions in data/cache/kimovil_specs.db.

Configuration

Defaults live in src/core/config.py; CLI flags override them.

Setting Default
LOCATION alma-ata
MIN_PRICE / MAX_PRICE 90,000 / 380,000 KZT
MAX_PAGES 25 per price slice (OLX's maximum)
DAYS_BACK 25
PHONE_TYPE_FILTER android (--phone-type android|iphone|both)
REQUEST_DELAY 1.5 s between OLX requests

Kimovil pacing is in src/core/constants.py: KIMOVIL_MAX_CONCURRENT = 2, KIMOVIL_REQUEST_DELAY = 2.5 s. Each model is fetched at most once per run.

Troubleshooting

  • OLX returns 403 on every page. CloudFront blocks by TLS fingerprint. Try another IMPERSONATE target in src/core/browser_transport.py, or update curl_cffi.
  • Kimovil answers 429 for most phones. That is a Cloudflare block on your IP after a burst of requests, not a normal rate limit. Wait a few hours and run ./run.sh --analyze again; found specs are cached, so each run fills in more.

Limitations

  • Market prices are maintained by hand (src/analysis/market_data.py, 102 models).
  • OLX.kz only; listing text is expected in Russian or Kazakh.

Development

uv run pytest               # tests (+ coverage report in htmlcov/)
uv run ruff check . && uv run ruff format --check .

See CONTRIBUTING.md.

License

MIT

Metadata

Release files for olx-phone-scout 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for olx-phone-scout 1.0.4
File Size Uploaded Provenance Actions
olx_phone_scout-1.0.4.tar.gz 127.5 kB With provenance Details for olx_phone_scout-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for olx-phone-scout 1.0.4
File Interpreter ABI Platform Actions
olx_phone_scout-1.0.4-py3-none-any.whl Python 3 none any Details for olx_phone_scout-1.0.4-py3-none-any.whl

Total release size: 226.4 kB

Release files / olx_phone_scout-1.0.4.tar.gz

Download URL olx_phone_scout-1.0.4.tar.gz
Size 127.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d1562cbddbc81ec7265b11f3bec758b85a693ac99f77808371907cc88e2c8ef0
BLAKE2b-256 checksum
How to use checksums
4893184f10a9caf114e1805d86d7e8b6ece5b356cb516980131512855146a75b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / olx_phone_scout-1.0.4-py3-none-any.whl

Download URL olx_phone_scout-1.0.4-py3-none-any.whl
Size 98.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e5347a6e176cfd7b8e039de35cfb1eaccf5125310a950dda9e65da5ab6b58be
BLAKE2b-256 checksum
How to use checksums
5ddd1128007a616693529922ef35a5c463cf0f615ffd98a70de39db069d54d53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for olx-phone-scout 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for olx_phone_scout-1.0.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page