# Allrecipes Scraper (`dtrungtin/allrecipes-scraper`) Actor

Scrape recipes from Allrecipes with ingredients and directions. This easy-to-use actor gets you an Allrecipes dataset in different formats according to your needs.

- **URL**: https://apify.com/dtrungtin/allrecipes-scraper.md
- **Developed by:** [Tin](https://apify.com/dtrungtin) (community)
- **Categories:** Other
- **Stats:** 325 total users, 0 monthly users, 100.0% runs succeeded, 7 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

#### Allrecipes Scraper

Allrecipes Scraper is an [Apify actor](https://apify.com/actors) for extracting data about actors from [Allrecipes](https://www.allrecipes.com/recipes). It allows you to extract all recipes for the given search text and/or the given list of start urls. It is build on top of [Apify SDK](https://sdk.apify.com/) and you can run it both on [Apify platform](https://my.apify.com) and locally.

- [Input](#input)
- [Output](#output)
- [Compute units consumption](#compute-units-consumption)
- [Extend output function](#extend-output-function)

#### Input

| Field | Type | Description | Default value
| ----- | ---- | ----------- | -------------|
| searchText | string | Search recipes by text, separate more than one recipe using comma | empty |
| startUrls | array | List of [Request](https://sdk.apify.com/docs/api/request#docsNav) objects that will be deeply crawled instead of search text. The URL can be top level like `https://www.allrecipes.com/recipes`, any category/search URL or detail URL | `[{ "url": "https://www.allrecipes.com/recipe/50644" }]`|
| maxItems | number | Maximum number of actor pages that will be scraped | all found |
| extendOutputFunction | string | Function that takes a Cheerio handle ($) as argument and returns data that will be merged with the result output. More information in [Extend output function](#extend-output-function) | |
| proxyConfiguration | object | Proxy settings of the run. If you have access to Apify proxy, leave the default settings. If not, you can set `{ "useApifyProxy": false" }` to disable proxy usage | `{ "useApifyProxy": true }`|

#### Output

Output is stored in a dataset. Each item is an information about a recipe. Example:

```
{
  "url": "https://www.allrecipes.com/recipe/247158/asian-steak-and-noodle-bowl/",
  "name": "Asian Steak and Noodle Bowl",
  "rating": "4.79",
  "ratingcount": "11",
  "ingredients": "1/2 cup low-sodium soy sauce, 1/3 cup vegetable oil, 1/3 cup brown sugar, 1 tablespoon minced ginger, 1/2 teaspoon garlic powder, 2 pounds flank steak, 1 (10 ounce) package dried Japanese udon noodles, 6 ounces snow peas, 1 cup broccoli florets, 1 tablespoon mirin (Japanese sweet wine)",
  "directions": "1. Whisk soy sauce, vegetable oil, brown sugar, ginger, and garlic powder together in a large bowl. Pierce flank steak several times with a large fork. Place in the bowl and cover with plastic wrap. Let marinate in the refrigerator, at least 4 hours and up to overnight. 2. Bring a large pot of salted water to a boil. Cook udon noodles in boiling water, stirring occasionally, until tender yet firm to the bite, 13 to 14 minutes. Drain. 3. Heat a large skillet over high heat. Remove steak from marinade and cook until well-browned, about 2 minutes per side. Reserve marinade. 4. Preheat grill for medium heat and lightly oil the grate. Grill steak, basting with half of the reserved marinade, until internal temperature reaches 140 degrees F (60 degrees C) for medium or 150 degrees F (65 degrees C) for medium-well, at least 10 minutes per side. Slice steak thinly against the grain. 5. Combine remaining marinade, snow peas, broccoli florets, and mirin in the skillet. Cook and stir over medium-high heat until snow peas are tender, about 2 minutes. Add drained noodles; mix well to combine. 6. Divide noodle mixture among large bowls. Top with steak slices.",
  "prep": "15 m",
  "cook": "44 m",
  "ready in": "4 h 59 m",
  "calories": "660"
}
```

#### Compute units consumption

Keep in mind that it is much more efficient to run one longer scrape (at least one minute) than more shorter ones because of the startup time.

The average consumption is **1 Compute unit for 1000 actor pages** scraped

#### Extend output function

You can use this function to update the result output of this actor. This function gets a JQuery handle `$` as an argument so you can choose what data from the page you want to scrape. The output from this will function will get merged with the result output.
The second parameter is the already scraped object from the recipe page.

The return value of this function has to be an object!

You can return fields to achive 3 different things:

- Add a new field - Return object with a field that is not in the result output
- Change a field - Return an existing field with a new value
- Remove a field - Return an existing field with a value `undefined`

```js
($, pageResult) => {
    // pageResult is the original item, you can use it here
    return {
        "author": $('[itemprop=author]').text(),
        "name": "NA",
        url: undefined,
    }
}
```

This example will add a new field `author`, change the `name` field and remove `url` field

```
{
  "author": "Chrissy Gaynor",
  "name": "NA",
  "rating": "4.79",
  "ratingcount": "11",
  "ingredients": "1/2 cup low-sodium soy sauce, 1/3 cup vegetable oil, 1/3 cup brown sugar, 1 tablespoon minced ginger, 1/2 teaspoon garlic powder, 2 pounds flank steak, 1 (10 ounce) package dried Japanese udon noodles, 6 ounces snow peas, 1 cup broccoli florets, 1 tablespoon mirin (Japanese sweet wine)",
  "directions": "1. Whisk soy sauce, vegetable oil, brown sugar, ginger, and garlic powder together in a large bowl. Pierce flank steak several times with a large fork. Place in the bowl and cover with plastic wrap. Let marinate in the refrigerator, at least 4 hours and up to overnight. 2. Bring a large pot of salted water to a boil. Cook udon noodles in boiling water, stirring occasionally, until tender yet firm to the bite, 13 to 14 minutes. Drain. 3. Heat a large skillet over high heat. Remove steak from marinade and cook until well-browned, about 2 minutes per side. Reserve marinade. 4. Preheat grill for medium heat and lightly oil the grate. Grill steak, basting with half of the reserved marinade, until internal temperature reaches 140 degrees F (60 degrees C) for medium or 150 degrees F (65 degrees C) for medium-well, at least 10 minutes per side. Slice steak thinly against the grain. 5. Combine remaining marinade, snow peas, broccoli florets, and mirin in the skillet. Cook and stir over medium-high heat until snow peas are tender, about 2 minutes. Add drained noodles; mix well to combine. 6. Divide noodle mixture among large bowls. Top with steak slices.",
  "prep": "15 m",
  "cook": "44 m",
  "ready in": "4 h 59 m",
  "calories": "660"
}
```

#### Epilogue

Thank you for trying my actor. I will be very glad for a feedback that you can send to my email `dtrungtin@gmail.com`. If you find any bug, please create an issue on the [Github page](https://github.com/dtrungtin/actor-allrecipes-scraper).

# Actor input Schema

## `searchText` (type: `string`):

Search recipes by text, separate more than one recipe using comma

## `startUrls` (type: `array`):

List of URLs that will be scraped or crawled instead of search text.

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

Limit of detail/product pages to be scraped

## `extendOutputFunction` (type: `string`):

Function that takes a JQuery handle ($) as argument and returns data that will be merged with the default output

## `proxyConfiguration` (type: `object`):

The best option is usually Automatic proxy. But you can also use your own proxies or no proxy

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.allrecipes.com/recipes/276/desserts/cakes/"
    }
  ],
  "maxItems": 50,
  "extendOutputFunction": "($, pageResult) => {\n  return {}\n}",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.allrecipes.com/recipes/276/desserts/cakes/"
        }
    ],
    "maxItems": 50,
    "extendOutputFunction": ($, pageResult) => {
      return {}
    },
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dtrungtin/allrecipes-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 = {
    "startUrls": [{ "url": "https://www.allrecipes.com/recipes/276/desserts/cakes/" }],
    "maxItems": 50,
    "extendOutputFunction": """($, pageResult) => {
  return {}
}""",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("dtrungtin/allrecipes-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 '{
  "startUrls": [
    {
      "url": "https://www.allrecipes.com/recipes/276/desserts/cakes/"
    }
  ],
  "maxItems": 50,
  "extendOutputFunction": "($, pageResult) => {\\n  return {}\\n}",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call dtrungtin/allrecipes-scraper --silent --output-dataset

```

## MCP server setup

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