@peristyle/emdash-plugin-instagram-to-recipe
v0.1.6
Published
Import Instagram post URLs as recipe drafts in the EmDash admin
Readme
@peristyle/emdash-plugin-instagram-to-recipe
Import public Instagram posts into your EmDash site as draft recipe posts — one at a time by URL, or in bulk by scanning a profile.
For a post URL such as instagram.com/p/DXkhLGbEcOY the plugin will:
- Fetch the post and read the caption (profile API first, HTML Open Graph metadata as fallback)
- Parse ingredients (
What you'll need/Ingredients:) and numbered steps — including captions Instagram has collapsed onto one line - Download the post feed image (the embedded
display_url, not the OG share-card with a play button) and store its dimensions for responsive images - Create a draft post in your configured collection
Install
pnpm add @peristyle/emdash-plugin-instagram-to-recipe
# or: npm install / yarn addRegister in astro.config.mjs:
import { instagramToRecipePlugin } from "@peristyle/emdash-plugin-instagram-to-recipe";
export default defineConfig({
integrations: [
emdash({
plugins: [instagramToRecipePlugin()],
}),
],
});Rebuild or restart the dev server after adding the plugin.
Admin usage
Open Plugins → Import from Instagram in the EmDash admin. The page has three sections:
Single post
- Paste an Instagram post URL and click Convert to recipe
- Review the parsed preview (title, ingredients, steps, featured image)
- Click Create draft post
- Edit the draft under Posts (slug, categories, times, publish)
Bulk import from a profile
- Enter a public Instagram handle and click Scan profile
- The profile grid is fetched in a single request and every caption that parses as a recipe is listed, sorted by likes
- Check the recipes you want (already-imported posts are unchecked and labeled) and click Create selected drafts
Bulk import is idempotent — posts already imported are skipped. Deleting an imported draft clears the bookkeeping, so the post can be imported again later.
Settings
- Content collection — where drafts are created (default:
posts) - Instagram handle (optional) — pre-fills the bulk scan and lets single-post imports go straight to the profile API; when empty, the post owner's handle is detected automatically
Standard-format EmDash plugins are configured here (settings are stored in the plugin's KV store), not via constructor options.
Capabilities
| Capability | Purpose |
| ----------------- | ----------------------------------- |
| network:request | Fetch Instagram HTML and CDN images |
| content:read | Check for prior imports |
| content:write | Create draft posts |
| media:write | Upload featured images |
Allowed hosts: www.instagram.com, *.cdninstagram.com, *.fbcdn.net.
API routes
For scripting or a custom admin UI:
| Route | Method | Body |
| -------------- | ------ | ------------------------------------- |
| parse | POST | { "url": "https://..." } |
| create-draft | POST | { "shortcode": "DXkhLGbEcOY" } |
| bulk-scan | POST | { "handle": "somefoodblogger" } |
| bulk-create | POST | { "shortcodes": ["DXkhLGbEcOY"] } |
Base path: /_emdash/api/plugins/peristyle-instagram-to-recipe/<route>
Limitations
- Public posts only — private or login-walled posts cannot be read
- Caption format — works best with a “What you'll need” / “Ingredients:” section plus numbered steps
- Bulk scan depth — one profile request returns roughly the 12 most recent posts; older posts can still be imported individually by URL
- Instagram rate limits — repeated fetches may hit HTTP 429; responses are cached for 24 hours and stale cache is used as a fallback, but you may need to wait and retry
- No video frames — video posts use the feed thumbnail, not in-video text
Building from source
The TypeScript source ships in the package under src/. From an unpacked copy:
pnpm install
pnpm build
pnpm typecheckThe development repository is not currently public.
License
MIT
