How to scrape Jiji marketplace listings across Nigeria, Kenya, Ghana, Tanzania and Uganda in Node.js using an Apify actor
# How to Scrape Jiji in Node.js
This repository shows how to scrape Jiji — Africa's largest online classifieds marketplace — using Node.js and the Jiji Listings Scraper on Apify. One input field switches between **five country marketplaces**: Nigeria, Kenya, Ghana, Tanzania, and Uganda.
Instead of building a scraper from scratch — and, more to the point, instead of sourcing residential proxies in five African countries — this example calls a ready-made Apify actor and processes the structured results.
## What this example does
- Calls the `piotrv1001/jiji-listings-scraper` actor on Apify
- Scrapes the Lagos car market within a price band
- Waits for the actor run to finish
- Fetches all items from the run's default dataset
- Prints each listing to the console
## Prerequisites
- Node.js 18 or newer
- An Apify account (free tier works)
- Your Apify API token — find it in Apify Console → Settings → API & Integrations
## Installation
```bash
npm install
```
## Environment setup
Copy the example env file and add your token:
```bash
cp .env.example .env
```
Then open `.env` and replace `your_apify_token_here` with your real Apify API token.
## Usage
```bash
npm start
```
You should see the run start, a link to the dataset in Apify Console, and the scraped listings logged to your terminal.
## Code example
```js
import { ApifyClient } from 'apify-client';
import 'dotenv/config';
// Initialize the ApifyClient with your Apify API token
// Set APIFY_TOKEN in your .env file (copy .env.example to get started)
const client = new ApifyClient({
token: process.env.APIFY_TOKEN,
});
// Prepare Actor input
// `country` picks the marketplace (ng, ke, gh, tz, ug) and the proxy region is
// matched automatically. Set `scrapeItemDetails` to true for view counts,
// favorite counts, posting dates and seller contacts (one extra request each).
const input = {
"country": "ng",
"categorySlug": "cars",
"regionSlug": "lagos",
"priceMin": 5000000,
"priceMax": 50000000,
"maxIte …