DEV Community

Gio Rich
Gio Rich

Posted on

Getting Kijiji ads and prices as JSON with Python (Canada classifieds, no browser)

I built this actor; it's a paid tool on Apify with a free trial credit.

Kijiji is Canada's biggest classifieds site: about 1.8 million ads in Ontario alone, from bikes and phones to couches, cars and rentals. If you flip items, price something before you list it, or want to know what a used iPhone 13 really goes for in Toronto versus Montréal, Kijiji is the closest thing to a live price list for the Canadian second-hand market.

There's no public API. I'm an 18-year-old engineering student, and I built Kijiji Scraper to turn its search pages into clean rows. This post covers how it works, calling it from Python, what a row looks like, and a small project: a free-stuff alert for one city.

How it works

Kijiji's search pages carry their 40 results (plus a few paid top ads) as a JSON cache inside the page, so one plain HTTP request gives 40 ads with price, condition, "for sale by", city, posted time, attributes and photos. For cars the attributes include make, model, year and mileage, which the actor puts in their own columns. Ad pages add the full description, view count, offer / wanted and expiry date; includeDetails: true opens them.

Kijiji's robots.txt bars the price, sort and radius URL parameters, so the actor builds plain keyword / category / location URLs and applies its own filters to every page. Ads it reads but drops are free. Locations and categories are typed as words (Toronto, BC, Bikes, Cars & Trucks); 208 places and 353 categories are built in.

Python example

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

run = client.actor("rel8ble/kijiji-scraper").call(run_input={
    "searchQueries": ["iphone 13"],
    "locations": ["Toronto", "Montreal"],
    "categories": ["Phones"],
    "priceMin": 150,
    "priceMax": 600,
    "sellerType": "private",
    "maxItems": 50,
})

for ad in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(ad["city"], "|", ad["title"], "|", ad["price"])
Enter fullscreen mode Exit fullscreen mode

What a row looks like

Shortened, from a real run with details:

{
    "id": "1746135946",
    "title": "iPhone 13 ProMax 128GB",
    "price": 400,
    "priceType": "fixed",
    "currency": "CAD",
    "sellerType": "private",
    "attributes": { "phonebrand": "apple", "forsaleby": "ownr", "phonecarrier": "unlck" },
    "city": "Cranbrook",
    "province": "BC",
    "postalCodePrefix": "V1C",
    "postedAt": "2026-11-13T16:47:06.000Z",
    "isTopAd": false,
    "categoryPath": "Buy & Sell > Phones > Cell Phones",
    "listingType": "OFFER",
    "views": 41
}
Enter fullscreen mode Exit fullscreen mode

Project: a free-stuff alert

import json, os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("rel8ble/kijiji-scraper").call(run_input={
    "categories": ["Buy & Sell"],
    "locations": ["Ottawa"],
    "priceTypes": ["free"],
    "postedWithinDays": 0,
    "maxItems": 0,
})

SEEN = "seen.json"
seen = set(json.load(open(SEEN))) if os.path.exists(SEEN) else set()
for ad in client.dataset(run["defaultDatasetId"]).iterate_items():
    if ad["id"] not in seen:
        print("FREE:", ad["title"], "|", ad["city"], "|", ad["url"])
        seen.add(ad["id"])
json.dump(sorted(seen), open(SEEN, "w"))
Enter fullscreen mode Exit fullscreen mode

Category listings come newest first, so with postedWithinDays: 0 the actor stops at the first page of older ads. Run it every hour on an Apify schedule and pipe the prints into Telegram or Slack.

Things to know

  • Price: $0.50 per 1,000 ads, details included, no start fee.
  • Order: keyword searches are by relevance, category and location listings newest first, top ads on top (skipTopAds drops them).
  • Condition is only there when the seller sets it, about half of Buy & Sell ads.
  • No personal data: no poster names, phones, e-mails or street addresses; only the public poster id, city, province, the first 3 characters of the postal code, and coordinates rounded to about 1 km.

Questions or broken fields: the Issues tab on the actor page comes straight to me.

Kijiji Scraper on Apify


This article was drafted with AI and published by me.

Need a custom scraper or a ready dataset? Hire me on Fiverr: https://www.fiverr.com/rel8ble

Top comments (0)