import type { DatabaseSync } from "node:sqlite"; import { callLLM } from "../utils/llm.ts"; import { decodeHtmlChars } from "../utils/html.ts"; export default async (db: DatabaseSync, recipeId: string) => { let recipeUrl = ""; if (!recipeId) throw new Error("Please provide a recipe ID"); else if (recipeId.startsWith("https://")) recipeUrl = recipeId; else recipeUrl = `https://cookidoo.fr/recipes/recipe/fr-FR/${recipeId}`; const recipePage = await fetch(recipeUrl).then((res) => res.text()); const jsonLdTag = recipePage.match( /