# GrubHub Scraper  🚀 (`natanielsantos/grubhub-scraper`) Actor

This no-code tool allows you to easily scrape data from GrubHub. Restaurant details like location, menu, logo, review count and more. Fast and reliable!  🔥

- **URL**: https://apify.com/natanielsantos/grubhub-scraper.md
- **Developed by:** [Nataniel Santos](https://apify.com/natanielsantos) (community)
- **Categories:** Automation
- **Features:** Limited permissions
- **Stats:** 41 total users, 11 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 restaurants

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 does GrubHub Scraper do?

This actor scrapes GrubHub for restaurant data. It extracts comprehensive data, enabling you to analyze restaurant offerings, pricing, and more.

### ✨ Features

- 📊 Extracts detailed restaurant information including name, address, phone number, menu items and more
- 🏷️ Supports scraping by restaurant URLs, search results URLs, or search terms with location
- 🚀 High-performance with built-in proxy rotation
- 📅 Supports pagination to scrape multiple pages from search results
- 🔄 Automatically handles retries for failed requests
- 📦 Outputs data in JSON format for easy integration with other tools

### 🎯 Use Cases

- **Market Research**: Analyze restaurant offerings and pricing in specific areas
- **Competitive Analysis**: Compare restaurant menus and prices
- **Data Enrichment**: Enhance your datasets with detailed restaurant information
- **Business Intelligence**: Gain insights into restaurant trends and customer preferences
- **Academic Research**: Study food industry trends and consumer behavior

### 💡 Input Parameters

The actor accepts the following input parameters:

- `urls` (Optional): A list of URLs to scrape. It can be multiple **restaurant URLs** or a single **search results** page URL
- `maxItems` (Optional): The maximum number of restaurants to scrape from the provided URLs or search term. Default is 100
- `searchTerm` (Optional): Alternatively, you can provide a search term instead of URLs.
- `location` (Optional): Location to search for restaurants. You can provide a city like 'New York, NY', or zip code.
- `sortBy` (Optional): The sorting criteria for search results. Options include `recommended`, `distance`, `fastest`, `rating`, `cheapest` and `most_expensive`. Default is `recommended`
- `deliveryType` (Optional): The type of delivery to filter search results. Options include `delivery` or `pickup`. Default is `delivery`
- `scrapeMenu` (Optional): Whether to scrape menu items for each restaurant. It raises the run time significantly, so use it only if necessary. Default is `false`
- `scrapeAvailableHours` (Optional): Whether to scrape available hours for each restaurant. Default is `false`

### 📥 Input Examples

##### 🔗 Scraping by Search URLs

```json
{
  "urls": [
    "https://www.grubhub.com/search?orderMethod=delivery&locationMode=DELIVERY&facetSet=umamiV6&pageSize=36&hideHateos=true&searchMetrics=true&latitude=40.71277618&longitude=-74.00597382&geohash=dr5regw3pgd3&includeOffers=true&featureControl=fastTagBadges%3Atrue&sortSetId=umamiV3&countOmittingTimes=true"
  ],
  "maxItems": 100,
  "scrapeMenu": true,
  "scrapeAvailableHours": true
}
```

##### 🔗 Scraping by Restaurant URLs

```json
{
  "urls": [
    "https://www.grubhub.com/restaurant/20-dollar-pizza-642-9th-ave-new-york/1172686",
    "https://www.grubhub.com/restaurant/pizza-hut-123-main-street-new-york/1234567"
  ],
  "scrapeMenu": true,
  "scrapeAvailableHours": true
}
```

##### 🔍 Scraping by Search Term and Location

```json
{
  "searchTerm": "pizza",
  "location": "New York, NY",
  "maxItems": 100,
  "sortBy": "recommended",
  "deliveryType": "delivery",
  "scrapeMenu": true,
  "scrapeAvailableHours": true
}
```

### 📦 Output Format

The output is a JSON array containing objects with the following fields:

- `logoUrl`: URL of the restaurant's logo
- `url`: GrubHub URL of the restaurant
- `name`: Name of the restaurant
- `id`: Unique identifier for the restaurant
- `description`: Description of the restaurant
- `phoneNumber`: Phone number of the restaurant
- `cuisines`: List of cuisines offered by the restaurant
- `deliveryInfo`: Object containing delivery information
  - `fee`: Delivery fee
  - `timeEstimate`: Estimated delivery time (min and max)
  - `available`: Whether delivery is available
- `location`: Object containing location details
  - `address`: Street address of the restaurant
  - `city`: City where the restaurant is located
  - `postalCode`: Postal code of the restaurant's location
  - `country`: Country of the restaurant (if available)
  - `latitude`: Latitude coordinate of the restaurant
  - `longitude`: Longitude coordinate of the restaurant
- `currencyCode`: Currency code used by the restaurant
- `rating`: Average rating of the restaurant
- `ratingCount`: Number of ratings the restaurant has received
- `priceRating`: Price rating of the restaurant (1-4 scale)
- `menuItems`: Array of menu items (if `scrapeMenu` is true)
  - `id`: Unique identifier for the menu item
  - `name`: Name of the menu item
  - `description`: Description of the menu item
  - `price`: Object containing prices for pickup and delivery
    - `pickup`: Price for pickup
    - `delivery`: Price for delivery
  - `imageUrl`: URL of the menu item's image (if available)
- `availableHours`: Array of available hours for the restaurant (if `scrapeAvailableHours` is true)

### 📤 Output Example

This is an example of the output you can expect from this actor. You can choose in which format to download your data: JSON, JSONL, Excel spreadsheet, HTML table, CSV, or XML.

```json
{
    "logoUrl": "https://res.cloudinary.com/grubhub/image/upload/k4ew096v2bajcbkhzbda.jpg",
    "url": "https://www.grubhub.com/restaurant/20-dollar-pizza-642-9th-ave-new-york/1172686",
    "name": "20 Dollar Pizza",
    "id": "1172686",
    "description": "",
    "phoneNumber": "2122456260",
    "cuisines": [
        "Pizza"
    ],
    "deliveryInfo": {
        "fee": 0,
        "timeEstimate": {
            "min": 35,
            "max": 50
        },
        "available": true
    },
    "location": {
        "address": "642 9th Ave",
        "city": "New York",
        "postalCode": "10036",
        "country": "",
        "latitude": 40.7603302,
        "longitude": -73.99082947
    },
    "currencyCode": "USD",
    "rating": "3",
    "ratingCount": 27,
    "priceRating": 2,
    "menuItems": [
        {
            "id": "49249629",
            "name": "Mozzarella Sticks",
            "description": "Served with marinara sauce.",
            "price": {
                "pickup": 9.95,
                "delivery": 9.95
            },
            "imageUrl": "https://media-cdn.grubhub.com/image/upload/ucywmpm8etd4xfpfmfre.jpg"
        },
        ...
    ],
    "availableHours": [
        {
            "dayOfWeek": 1,
            "timeRanges": [
                "13:30-08:00"
            ]
        },
        ...
    ]
}
```

### 💲 How much will scraping GrubHub cost you?

The pricing changes according to your Apify plan.

Plan | Restaurant Result | Menu Result
\--- | --- | ---
Free | $5/1000 restaurants | $7/1000 menus
Starter | $4/1000 restaurants | $5/1000 menus
Scale | $3.5/1000 restaurants | $4.5/1000 menus
Business | $3/1000 restaurants | $4/1000 menus

💡 Note: The cost of scraping menus is only applicable if you enable the `scrapeMenu` option. It's only charged once per restaurant, regardless of the number of menu items.

### 🧩 Integrations and GrubHub Scraper

Last but not least, GrubHub Scraper can be connected with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). You can integrate with Make, Zapier, Slack, Airbyte, GitHub, Google Sheets, Google Drive, [and more](https://docs.apify.com/integrations). Or you can use [webhooks](https://docs.apify.com/integrations/webhooks) to carry out an action whenever an event occurs, e.g. get a notification whenever GrubHub Scraper successfully finishes a run.

### 🔌 Using GrubHub Scraper with the Apify API

The Apify API gives you programmatic access to the Apify platform. The API is organized around RESTful HTTP endpoints that enable you to manage, schedule, and run Apify actors. The API also lets you access any datasets, monitor actor performance, fetch results, create and update versions, and more.

To access the API using Node.js, use the apify-client NPM package. To access the API using Python, use the apify-client PyPI package.

Check out the [Apify API reference](https://docs.apify.com/api/v2) docs for full details.

### 💭 Giving feedback

If you have any feature requests or bug reports, please create an issue on the [Issues page](https://apify.com/natanielsantos/grubhub-scraper/issues).

If you need a custom solution of this actor, reach out to me through my email: nathan.santos159@hotmail.com

# Actor input Schema

## `urls` (type: `array`):

List of Restaurant URLs or Search URLs to scrape from Grubhub.

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

Maximum number of restaurants to scrape from a Search results URL.

## `scrapeMenu` (type: `boolean`):

Whether to scrape the menu items from the restaurant page.

## `scrapeAvailableHours` (type: `boolean`):

Whether to scrape the available hours from the restaurant page.

## `searchTerm` (type: `string`):

Alternative to scrape using URLs. You can provide a search term to scrape restaurants, like 'pizza', 'hamburger', etc.

## `location` (type: `string`):

Location to search for restaurants. You can provide a city like 'New York, NY', or zip code.

## `sortBy` (type: `string`):

Sort the search results by a specific criteria.

## `deliveryType` (type: `string`):

Filter the search results by delivery type.

## Actor input object example

```json
{
  "urls": [
    "https://www.grubhub.com/restaurant/gopuff---convenience-alcohol--more-1-york-st-new-york/4650320"
  ],
  "maxItems": 100,
  "scrapeMenu": false,
  "scrapeAvailableHours": false,
  "searchTerm": "pizza",
  "location": "New York, NY",
  "sortBy": "recommended",
  "deliveryType": "delivery"
}
```

# Actor output Schema

## `restaurants` (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 = {
    "urls": [
        "https://www.grubhub.com/restaurant/gopuff---convenience-alcohol--more-1-york-st-new-york/4650320"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("natanielsantos/grubhub-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 = { "urls": ["https://www.grubhub.com/restaurant/gopuff---convenience-alcohol--more-1-york-st-new-york/4650320"] }

# Run the Actor and wait for it to finish
run = client.actor("natanielsantos/grubhub-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 '{
  "urls": [
    "https://www.grubhub.com/restaurant/gopuff---convenience-alcohol--more-1-york-st-new-york/4650320"
  ]
}' |
apify call natanielsantos/grubhub-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,natanielsantos/grubhub-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/Dk45auvk9CiglEduQ/builds/aCkZaMyBXVOAZGo40/openapi.json
