# Ninja Scraper: Saudi Restaurants and Delivery (`happyendpoint/ninja-saudi-restaurant-scraper`) Actor

Find restaurants that deliver to any point in Saudi Arabia on Ninja. Get branch name, open status, rating, delivery distance and fee, running offers and matching dishes. Filter by cuisine, free delivery, top rating or offers, or open a branch.

- **URL**: https://apify.com/happyendpoint/ninja-saudi-restaurant-scraper.md
- **Developed by:** [Happy Endpoint](https://apify.com/happyendpoint) (community)
- **Categories:** E-commerce, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What this Actor does

This Actor reads the restaurant listings of Ninja, a food delivery service in Saudi Arabia, for any delivery point you give as coordinates. Each row is one restaurant branch with its name, open or closed status, rating and vote count, distance, delivery time, delivery fee, running offers and the dishes that match your keyword. Search by keyword, cuisine, free delivery, top rating or offers, open one branch by its number or page link, look up the closest branch of a chain, or list the cuisines, filters and delivery information for a spot.

The data is what Ninja shows to any visitor who enters a delivery point: restaurants, ratings, delivery fees and times, offers and matching dishes.

### Use cases

- Compare delivery fees and waiting times of restaurants across neighborhoods of one city.
- Track which restaurants run offers or free delivery and how long the offers last.
- Map the restaurant supply by cuisine for a district before opening a new kitchen.
- Check the ratings and vote counts of every branch of a chain.
- Find which restaurants serve a dish by searching the dish name.

### How to use

1. Open the Actor's input form in Apify Console, or prepare a JSON input for the API.
2. Pick an `operation`: each one is a different kind of request to Ninja.
3. Set `maxItems` to the number of results you need. It is the only quantity setting; paging is handled for you.
4. Start the run. The results land in the run's dataset, where you can download them as JSON, CSV, Excel and
   other formats, or read them through the Apify API.

This is the example input, the one the input form starts with:

```json
{
  "operation": "restaurants",
  "maxItems": 10,
  "latitude": 24.7136,
  "longitude": 46.6753,
  "language": "en"
}
```

### Input

| Field | Type | Description | Used by |
| --- | --- | --- | --- |
| `operation` | string | Which data to fetch. Each option is one kind of request. | all operations |
| `maxItems` | integer | The most results to return. The run stops once it has this many. | all operations |
| `url` | string | A link copied from your browser: one restaurant page for Restaurant by page link, or a browse or cuisine page for Restaurants by page link. | Restaurant by page link, Restaurants by page link |
| `branchId` | string | The number of one restaurant branch, as search rows return it in branch_id. A restaurant link ends with it. | Restaurant branch details |
| `restaurantId` | string | The number of a restaurant brand or chain, found inside the restaurant block of a search row. It is not a branch ID. | Closest branch of a chain |
| `latitude` | number | North-south position of the place where food would be delivered, as a decimal number. Distances, fees and waiting times depend on it. | Delivery info at a point, Cuisines, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link |
| `longitude` | number | East-west position of the delivery place, as a decimal number. Keep it identical in all operations of one task. | Delivery info at a point, Cuisines, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link |
| `language` | string | The language of names and labels in the rows. Leave it empty for English. | Delivery info at a point, Cuisines, Restaurant filters, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link |
| `query` | string | A restaurant, brand or dish to look for. Arabic and English text both work. Matching dishes are listed on the row. | Search restaurants, Restaurants by page link |
| `cuisineIds` | string | Cuisine numbers from Cuisines, with a comma between them. A restaurant that serves any of them is kept. | Search restaurants |
| `freeDelivery` | boolean | Keep only restaurants that deliver without a fee at the moment. | Search restaurants |
| `hasActiveDiscount` | boolean | Keep only restaurants that have at least one offer running now. | Search restaurants |
| `topRated` | boolean | Keep only restaurants that Ninja marks as top rated. The bar is set by the site. | Search restaurants |

### Output

Every row holds the run's own fields first (`operation`, `scrapedAt` and `sourceUrl`),
then the core fields `id`, `url`, `title`, `price`, `currency`, `location`, which are empty when the source has no such value,
and then every field of the source item as Ninja returns it. The dataset has an overview view and one view per
operation.

Run the Actor with the prefilled input to see a sample of the output.

### Pricing

This Actor uses pay-per-event pricing: a start fee of $0.002 for each run, plus
$0.002 for each result in the dataset. Every operation is priced the same way.

| Operation | Start fee per run | Price per result |
| --- | --- | --- |
| Delivery info at a point | $0.002 | $0.002 |
| Cuisines | $0.002 | $0.002 |
| Restaurant filters | $0.002 | $0.002 |
| Search restaurants | $0.002 | $0.002 |
| Restaurant branch details | $0.002 | $0.002 |
| Closest branch of a chain | $0.002 | $0.002 |
| Restaurant by page link | $0.002 | $0.002 |
| Restaurants by page link | $0.002 | $0.002 |

Worked examples for one run:

| Results | Total cost |
| --- | --- |
| 10 | $0.022 |
| 100 | $0.202 |
| 750 | $1.502 |

Invalid input, a not-found answer or an internal error adds no charge of its own: such a run pays the start
fee plus only the results it delivered before it stopped (none for invalid input). To cap what one run may
cost, set the maximum cost per run when you start it.

### Limits and tips

- One run returns at most 750 results; the input form allows no higher `maxItems`.
- Set `maxItems` to what you need: you pay per result, and a smaller run finishes sooner.
- A request that matches nothing ends with an empty dataset and costs only the start fee.
- Results depend on the delivery point. Use the same latitude and longitude for every operation of one task, or the fees and waiting times will not match.
- Only Saudi Arabia is served. A spot outside the service area returns no restaurants.
- A search page holds 15 branches and a run reads at most 50 pages, so one search returns up to 750 branches.
- Search by page link takes pages of the Ninja site only. A single branch page belongs to Restaurant by page link, and a listing page to Restaurants by page link.

### Resume a run that stopped at your cost limit

If you set a maximum cost per run and a run reaches it, the run stops early. To get the rest, resurrect the
run in Apify Console, or through the API, with a higher limit. The Actor resumes where it stopped: results
already in the dataset are not fetched or charged again, and the run still ends at `maxItems`.
Resurrecting can charge the start fee again.

### Running without input

The example input above is also this Actor's example run input. Apify's API documents that a run started with
no input at all uses the example run input: Search restaurants, at most 10 results,
which costs at most $0.022 (the start fee plus 10 results). For your own runs, always send an input with the fields you need.

### FAQ

#### Do I need an account on Ninja?

No. The Actor reads public data, so an Apify account is all you need.

#### How do I get the data into my own tools?

Download the dataset from the run's page, or read it through the Apify API and its integrations.

#### What is the difference between a branch ID and a brand ID?

A branch is one restaurant location and a brand is the chain behind it. The two numbers are separate series, so a branch ID cannot be used where a brand ID is asked for.

#### Which coordinates should I use?

The point where the food would be delivered, for example the middle of a neighborhood. Rows show the distance from that point and the delivery fee for it.

#### How do I find the cuisine numbers?

Run Cuisines for your point. Each row has an id and a name, and you pass the ids to Search restaurants as Cuisine IDs, with commas between them.

#### Are menus included?

Only the dishes that match your keyword are listed on a search row. Full menus are not part of this Actor.

### More Ninja Actors

This is the only Ninja Actor in this collection for now.

### Related Actors

- [bayt-job-search-scraper](https://apify.com/happyendpoint/bayt-job-search-scraper)
- [igraal-merchants-cashback-scraper](https://apify.com/happyendpoint/igraal-merchants-cashback-scraper)

### Disclaimer

This Actor is an independent tool. It is not affiliated with, endorsed by or sponsored by Ninja. All
trademarks belong to their owners.

### Is it legal to use this data?

This Actor collects data that Ninja shows publicly.
None of the fields it returns is marked as personal data.
Personal data is protected by laws such as the GDPR in the EU. Collect and use it only when you have a lawful
reason, keep only what you need, and do not use it for unsolicited messages. If you are unsure, ask a lawyer.

# Changelog

This Actor's version history is a separate document: https://apify.com/happyendpoint/ninja-saudi-restaurant-scraper/changelog.md

# Actor input Schema

## `operation` (type: `string`):

Which data to fetch. Each option is one kind of request.

## `maxItems` (type: `integer`):

The most results to return. The run stops once it has this many.

## `url` (type: `string`):

A link copied from your browser: one restaurant page for Restaurant by page link, or a browse or cuisine page for Restaurants by page link. Used by: Restaurant by page link, Restaurants by page link.

## `branchId` (type: `string`):

The number of one restaurant branch, as search rows return it in branch_id. A restaurant link ends with it. Used by: Restaurant branch details.

## `restaurantId` (type: `string`):

The number of a restaurant brand or chain, found inside the restaurant block of a search row. It is not a branch ID. Used by: Closest branch of a chain.

## `latitude` (type: `number`):

North-south position of the place where food would be delivered, as a decimal number. Distances, fees and waiting times depend on it. Used by: Delivery info at a point, Cuisines, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link.

## `longitude` (type: `number`):

East-west position of the delivery place, as a decimal number. Keep it identical in all operations of one task. Used by: Delivery info at a point, Cuisines, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link.

## `language` (type: `string`):

The language of names and labels in the rows. Leave it empty for English. Used by: Delivery info at a point, Cuisines, Restaurant filters, Search restaurants, Restaurant branch details, Closest branch of a chain, Restaurant by page link, Restaurants by page link.

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

A restaurant, brand or dish to look for. Arabic and English text both work. Matching dishes are listed on the row. Used by: Search restaurants, Restaurants by page link.

## `cuisineIds` (type: `string`):

Cuisine numbers from Cuisines, with a comma between them. A restaurant that serves any of them is kept. Used by: Search restaurants.

## `freeDelivery` (type: `boolean`):

Keep only restaurants that deliver without a fee at the moment. Used by: Search restaurants.

## `hasActiveDiscount` (type: `boolean`):

Keep only restaurants that have at least one offer running now. Used by: Search restaurants.

## `topRated` (type: `boolean`):

Keep only restaurants that Ninja marks as top rated. The bar is set by the site. Used by: Search restaurants.

## Actor input object example

```json
{
  "operation": "restaurants",
  "maxItems": 10,
  "latitude": 24.7136,
  "longitude": 46.6753,
  "language": "en"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `deliveryInfo` (type: `string`):

No description

## `cuisines` (type: `string`):

No description

## `restaurantFilters` (type: `string`):

No description

## `restaurants` (type: `string`):

No description

## `restaurantDetails` (type: `string`):

No description

## `restaurantByBrand` (type: `string`):

No description

## `restaurantByUrl` (type: `string`):

No description

## `restaurantsByUrl` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "operation": "restaurants",
    "maxItems": 10,
    "latitude": 24.7136,
    "longitude": 46.6753,
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("happyendpoint/ninja-saudi-restaurant-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 = {
    "operation": "restaurants",
    "maxItems": 10,
    "latitude": 24.7136,
    "longitude": 46.6753,
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("happyendpoint/ninja-saudi-restaurant-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "operation": "restaurants",
  "maxItems": 10,
  "latitude": 24.7136,
  "longitude": 46.6753,
  "language": "en"
}' |
apify call happyendpoint/ninja-saudi-restaurant-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,happyendpoint/ninja-saudi-restaurant-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wnmzcLHfgKtvDqEXr/builds/l0pt73FgpogJVBTI9/openapi.json
