@hammerhead/recipesearch
v1.0.0
Published
Search and fetch recipes from AllRecipes with details like ingredients, instructions, prep time, cook time, servings, and ratings.
Maintainers
Readme
@hammerhead/recipesearch
A simple Node.js package to search and fetch recipes from AllRecipes.
Get recipe titles, links, images, ingredients, instructions, prep/cook times, servings, and ratings — all in one structured JSON format.
Features
- Search recipes by keyword with pagination.
- Fetch detailed recipe information:
- Ingredients
- Step-by-step instructions
- Prep, cook, and total times
- Servings
- Ratings
- Images
- Easy to use with just one import.
- Robust error handling.
Installation
npm install @hammerhead/recipesearch
# or with pnpm
pnpm add @hammerhead/recipesearchUsage
import RecipeSearch from "@hammerhead/recipesearch";
// Initialize for AllRecipes
const recipes = RecipeSearch("AllRecipes");
// Search recipes
const results = await recipes.search("chocolate cake", 2); // 2 pages
console.log(results);
// Get detailed info for the first recipe
if (results.length > 0) {
const firstRecipe = await recipes.details(results[0].link);
console.log(firstRecipe);
}Search result
[
{
"title": "Ultimate Chocolate Cake",
"link": "https://www.allrecipes.com/recipe/12345/ultimate-chocolate-cake/",
"image": "https://images.allrecipes.com/photo.jpg"
}
]Detail result
{
"title": "Ultimate Chocolate Cake",
"image": "https://images.allrecipes.com/photo.jpg",
"rating": "4.8 stars",
"servings": "8",
"prepTime": "20 mins",
"cookTime": "30 mins",
"totalTime": "50 mins",
"ingredients": [
"2 cups flour",
"1 cup sugar",
"1/2 cup cocoa powder"
],
"instructions": [
"Preheat oven to 350°F (175°C).",
"Mix dry ingredients together.",
"Bake for 30 minutes."
]
}