← 返回
未分类

Gousto Meal Picker

Automate weekly Gousto meal kit selection via REST API with configurable dietary rules (allergens, cook time, protein variety). Handles order updates, menu s...
使用 REST API 自动进行每周 Gousto 餐盒选择,支持可配置的饮食规则(过敏原、烹饪时间、蛋白质多样性),处理订单更新和菜单同步。
charliedouglas
未分类 clawhub v1.2.1 1 版本 99519.2 Key: 无需
★ 2
Stars
📥 167
下载
💾 0
安装
1
版本
#latest

概述

Gousto Meal Picker

Automates weekly Gousto recipe selection via their REST API. No browser needed for picking — only for initial auth and token refresh.

Setup

1. First-time auth (browser required)

Use agent-browser to log into Gousto and save session state:

agent-browser open "https://www.gousto.co.uk/my-gousto" --headed
# User logs in manually (CAPTCHA blocks automated login)
agent-browser state save <workspace>/gousto/gousto-auth.json
agent-browser close

2. Create config

Create /gousto/config.json:

{
  "userId": "<auth_user_id from /user/current>",
  "numericUserId": "<numeric id>",
  "deviceId": "<from gousto_session_id cookie>",
  "subscriptionId": "<from subscription endpoint>",
  "shippingAddressId": "<from order>",
  "deliveryTariffId": "<from order>",
  "plan": {
    "mealsPerWeek": 4,
    "portions": 2
  },
  "rules": {
    "maxCookTimeMins": 45,
    "maxMealsOver40Mins": 1,
    "noNuts": true,
    "noFish": true,
    "maxPastaPerWeek": 1,
    "maxRicePerWeek": 1,
    "preferHealthy": true
  }
}

No passwords or credentials are stored in config.json. Auth is handled entirely via browser cookies saved in gousto-auth.json (from the login step above). The config only contains Gousto account IDs and selection rules.

To discover IDs: log in via browser, then call GET /user/current and inspect a pending order via GET /order/v2/orders/. See references/api.md for endpoint details.

3. Initialise selections tracker

Create /gousto/selections.json:

{ "selections": {} }

Usage

Run the picker

node <skill-dir>/scripts/gousto-pick.mjs [--dry-run] [--week ORDER_ID]
  • --dry-run — show what would be selected without updating the order
  • --week ORDER_ID — target a specific order instead of auto-detecting

Recommended cron schedule

Gousto menus open on Tuesdays at 12pm UK, 13 days before Monday delivery. Schedule the picker for Tuesdays at 1pm UK:

cron: "0 13 * * 2" (Europe/London)

Token refresh

Auth tokens expire ~10 hours after login. When the token expires, the agent should:

  1. Open Gousto in agent-browser (loads saved state → auto-refreshes)
  2. Save updated state: agent-browser state save /gousto/gousto-auth.json
  3. Retry the script

Auth endpoints are WAF-protected — curl cannot hit /oauth/access-token or /login directly. Browser-based refresh is the only reliable method.

Selection Rules (all configurable)

All rules are set in config.json under "rules". Every filter can be toggled on/off.

Hard filters (set to true to exclude)

RuleDefaultDescription
----------------------------
noNutstrueExclude recipes containing nuts (checks allergens + name)
noFishtrueExclude fish dishes
fishAndChipsExceptionfalseAllow fish & chips even when noFish is true
noSeafoodfalseExclude all seafood (broader: crab, lobster, squid, etc.)
noVegetariantrueExclude vegetarian meals
noPlantBasedtrueExclude plant-based/vegan meals
noDairyfalseExclude dairy-containing meals
noGlutenfalseExclude gluten-containing meals
maxCookTimeMins45Exclude recipes over this cook time
excludeAllergens[]Array of Gousto allergen slugs to exclude (e.g. ["sesame", "celery"])
excludeKeywords[]Exclude recipes whose name contains any of these strings

Soft constraints (limits per week)

RuleDefaultDescription
----------------------------
maxMealsOver40Mins1Max meals with 40+ min cook time
maxPastaPerWeek1Max pasta dishes
maxRicePerWeek1Max rice dishes
maxSameProtein2Max meals with the same protein

Scoring preferences

RuleDefaultDescription
----------------------------
preferHealthytrueBoost healthy/low-cal recipes, penalise high-cal
preferQuickertrueBoost faster cook times

Example config

{
  "rules": {
    "noNuts": true,
    "noFish": false,
    "noVegetarian": false,
    "maxCookTimeMins": 30,
    "maxPastaPerWeek": 2,
    "excludeKeywords": ["spicy", "chilli"],
    "excludeAllergens": ["sesame"],
    "preferHealthy": false
  }
}

Security notes

  • No passwords stored — auth uses browser cookies only (saved in gousto-auth.json)
  • Treat gousto-auth.json as sensitive — it contains OAuth tokens. Restrict file permissions (chmod 600)
  • Single API endpoint — the script only communicates with production-api.gousto.co.uk
  • Use --dry-run first — verify selections before enabling automated ordering
  • Required runtime — Node.js, curl, zsh shell, and agent-browser (for login/token refresh only)

File structure

gousto/
├── config.json          — User config, API IDs, dietary rules
├── gousto-auth.json     — Browser state (cookies with Bearer token)
├── selections.json      — History of selections made

版本历史

共 1 个版本

  • v1.2.1 当前
    2026-05-12 05:45 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,222 📥 267,263
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,896
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,070 📥 804,346