Skip to content

lmzbonack/RecipeExtractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipe Extractor

A Cloudflare Worker that extracts recipe data from any URL using AI.

Features

  • Extracts recipe name, author, prep time, cook time, ingredients, and instructions
  • Uses Cloudflare Workers AI with Llama 3.3 for structured extraction
  • Uses Browser Rendering to handle JavaScript-heavy recipe sites
  • Automatic fallback: tries networkidle2 first, falls back to simple request if it times out

API

Endpoint

GET /?url=<recipe-url>&key=<api-key>

Parameters

Parameter Description
url The URL of the recipe page (required)
key Your API key (required)

Response

{
  "name": "Classic Homemade Meatloaf",
  "author": "Christina",
  "prep_time_in_minutes": 15,
  "cook_time_in_minutes": 60,
  "ingredients": [
    "1 tbsp olive oil",
    "1 medium onion, diced",
    "..."
  ],
  "instructions": [
    "Preheat oven to 350°F.",
    "..."
  ]
}

Setup

1. Install dependencies

npm install

2. Set secrets

wrangler secret put API_KEY
wrangler secret put CLOUDFLARE_ACCOUNT_ID
wrangler secret put CLOUDFLARE_API_TOKEN
  • API_KEY: Your custom API key for authentication
  • CLOUDFLARE_ACCOUNT_ID: Your Cloudflare account ID
  • CLOUDFLARE_API_TOKEN: API token with "Browser Rendering - Edit" permissions

3. Deploy

npm run deploy

Development

npm run dev    # Start local dev server
npm run deploy # Deploy to Cloudflare

Usage Example

curl "https://recipe-extractor.your-subdomain.workers.dev/?url=https://www.budgetbytes.com/classic-homemade-meatloaf/&key=YOUR_API_KEY"

Tech Stack

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors