Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firecrawl-cli",
"version": "1.9.8",
"version": "1.10.0",
"description": "Command-line interface for Firecrawl. Scrape, crawl, and extract data from any website directly from your terminal.",
"main": "dist/index.js",
"bin": {
Expand Down
5 changes: 5 additions & 0 deletions skills/firecrawl-scrape/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ firecrawl scrape https://example.com https://example.com/blog https://example.co

# Get markdown and links together
firecrawl scrape "<url>" --format markdown,links -o .firecrawl/page.json

# Ask a question about the page
firecrawl scrape "https://example.com/pricing" --query "What is the enterprise plan price?"
```

## Options

| Option | Description |
| ------------------------ | ---------------------------------------------------------------- |
| `-f, --format <formats>` | Output formats: markdown, html, rawHtml, links, screenshot, json |
| `-Q, --query <prompt>` | Ask a question about the page content (5 credits) |
| `-H` | Include HTTP headers in output |
| `--only-main-content` | Strip nav, footer, sidebar — main content only |
| `--wait-for <ms>` | Wait for JS rendering before scraping |
Expand All @@ -50,6 +54,7 @@ firecrawl scrape "<url>" --format markdown,links -o .firecrawl/page.json

## Tips

- **Prefer plain scrape over `--query`.** Scrape to a file, then use `grep`, `head`, or read the markdown directly — you can search and reason over the full content yourself. Use `--query` only when you want a single targeted answer without saving the page (costs 5 extra credits).
- **Try scrape before browser.** Scrape handles static pages and JS-rendered SPAs. Only escalate to browser when you need interaction (clicks, form fills, pagination).
- Multiple URLs are scraped concurrently — check `firecrawl --status` for your concurrency limit.
- Single format outputs raw content. Multiple formats (e.g., `--format markdown,links`) output JSON.
Expand Down
13 changes: 12 additions & 1 deletion src/commands/scrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
ScrapeLocation,
} from '../types/scrape';
import { getClient } from '../utils/client';
import { handleScrapeOutput } from '../utils/output';
import { handleScrapeOutput, writeOutput } from '../utils/output';
import { getOrigin } from '../utils/url';
import { executeMap } from './map';
import { getStatus } from './status';
Expand Down Expand Up @@ -71,6 +71,11 @@ export async function executeScrape(
formats.push('screenshot');
}

// Inject query format if --query was provided
if (options.query) {
formats.push({ type: 'query', prompt: options.query } as any);
}

// If no formats specified, default to markdown
if (formats.length === 0) {
formats.push('markdown');
Expand Down Expand Up @@ -136,6 +141,12 @@ export async function handleScrapeCommand(
): Promise<void> {
const result = await executeScrape(options);

// Query mode: output answer directly
if (options.query && result.success && result.data?.answer) {
writeOutput(result.data.answer, options.output, !!options.output);
return;
}

// Determine effective formats for output handling
const effectiveFormats: ScrapeFormat[] =
options.formats && options.formats.length > 0
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ function createScrapeCommand(): Command {
'--languages <codes>',
'Comma-separated language codes for scraping (e.g., en,es)'
)
.option(
'-Q, --query <prompt>',
'Ask a question about the page content (query format)'
)

.action(async (positionalArgs, options) => {
// Collect URLs from positional args and --url option
Expand Down
2 changes: 2 additions & 0 deletions src/types/scrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export interface ScrapeOptions {
maxAge?: number;
/** Location settings for geo-targeted scraping */
location?: ScrapeLocation;
/** Question to ask about the page content (query format) */
query?: string;
}

export interface ScrapeResult {
Expand Down
1 change: 1 addition & 0 deletions src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@ export function parseScrapeOptions(options: any): ScrapeOptions {
timing: options.timing,
maxAge: options.maxAge,
location,
query: options.query,
};
}
Loading