firecrawl-instruct
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefirecrawl instruct
firecrawl instruct
Interact with scraped pages in a live browser session. Scrape a page first, then use natural language prompts or code to click, fill forms, navigate, and extract data.
在实时浏览器会话中与已爬取的页面进行交互。首先爬取页面,随后使用自然语言提示或代码执行点击、填写表单、导航、提取数据等操作。
When to use
适用场景
- Content requires interaction: clicks, form fills, pagination, login
- failed because content is behind JavaScript interaction
scrape - You need to navigate a multi-step flow
- Last resort in the workflow escalation pattern: search → scrape → map → crawl → instruct
- Never use instruct for web searches — use instead
search
- 内容需要交互才能获取:点击操作、表单填写、翻页、登录
- 命令执行失败,因为内容需要JavaScript交互才能加载
scrape - 需要导航多步骤流程
- 工作流升级模式的最终方案:搜索 → 爬取 → 映射 → 抓取 → instruct
- 绝对不要使用instruct进行网页搜索 —— 请改用命令
search
Quick start
快速开始
bash
undefinedbash
undefined1. Scrape a page (scrape ID is saved automatically)
1. 爬取页面(爬取ID会自动保存)
firecrawl scrape "<url>"
firecrawl scrape "<url>"
2. Interact with the page using natural language
2. 使用自然语言与页面交互
firecrawl interact --prompt "Click the login button"
firecrawl interact --prompt "Fill in the email field with test@example.com"
firecrawl interact --prompt "Extract the pricing table"
firecrawl interact --prompt "Click the login button"
firecrawl interact --prompt "Fill in the email field with test@example.com"
firecrawl interact --prompt "Extract the pricing table"
3. Or use code for precise control
3. 或使用代码实现精准控制
firecrawl interact --code "agent-browser click @e5" --language bash
firecrawl interact --code "agent-browser snapshot -i" --language bash
firecrawl interact --code "agent-browser click @e5" --language bash
firecrawl interact --code "agent-browser snapshot -i" --language bash
4. Stop the session when done
4. 操作完成后停止会话
firecrawl interact stop
undefinedfirecrawl interact stop
undefinedOptions
选项
| Option | Description |
|---|---|
| Natural language instruction (use this OR --code) |
| Code to execute in the browser session |
| Language for code: bash, python, node |
| Execution timeout (default: 30, max: 300) |
| Target a specific scrape (default: last scrape) |
| Output file path |
| 选项 | 说明 |
|---|---|
| 自然语言指令(与--code二选一使用) |
| 要在浏览器会话中执行的代码 |
| 代码语言:bash、python、node |
| 执行超时时间(默认:30,最大值:300) |
| 目标指定的爬取任务(默认:最近一次爬取) |
| 输出文件路径 |
Profiles
配置文件
Use on the scrape to persist browser state (cookies, localStorage) across scrapes:
--profilebash
undefined在爬取时使用参数可持久化浏览器状态(cookies、localStorage),在多次爬取间复用:
--profilebash
undefinedSession 1: Login and save state
会话1:登录并保存状态
firecrawl scrape "https://app.example.com/login" --profile my-app
firecrawl interact --prompt "Fill in email with user@example.com and click login"
firecrawl scrape "https://app.example.com/login" --profile my-app
firecrawl interact --prompt "Fill in email with user@example.com and click login"
Session 2: Come back authenticated
会话2:直接以已登录状态访问
firecrawl scrape "https://app.example.com/dashboard" --profile my-app
firecrawl interact --prompt "Extract the dashboard data"
Read-only reconnect (no writes to profile state):
```bash
firecrawl scrape "https://app.example.com" --profile my-app --no-save-changesfirecrawl scrape "https://app.example.com/dashboard" --profile my-app
firecrawl interact --prompt "Extract the dashboard data"
只读重连(不写入配置文件状态):
```bash
firecrawl scrape "https://app.example.com" --profile my-app --no-save-changesTips
使用提示
- Always scrape first — requires a scrape ID from a previous
interactcallfirecrawl scrape - The scrape ID is saved automatically, so you don't need for subsequent interact calls
--scrape-id - Use to free resources when done
firecrawl interact stop - For parallel work, scrape multiple pages and interact with each using
--scrape-id
- 始终先执行爬取操作 —— 命令需要使用之前
interact调用生成的爬取IDfirecrawl scrape - 爬取ID会自动保存,因此后续的interact调用不需要指定
--scrape-id - 操作完成后使用释放资源
firecrawl interact stop - 如果需要并行操作,可以爬取多个页面,通过分别与每个页面交互
--scrape-id
See also
另请参阅
- firecrawl-scrape — try scrape first, escalate to instruct only when needed
- firecrawl-search — for web searches (never use instruct for searching)
- firecrawl-agent — AI-powered extraction (less manual control)
- firecrawl-scrape —— 先尝试使用scrape,仅当必要时再升级使用instruct
- firecrawl-search —— 用于网页搜索(绝对不要使用instruct进行搜索)
- firecrawl-agent —— AI驱动的提取(手动控制程度更低)