Web Search Results
v1PublishedThe top 10 organic web search results for a given query — rank, title, URL, domain, and snippet. Parameter: query.
Output & API
Preview the latest data, download it, or call this collector as an API.
| count | 10 |
|---|---|
| query | best espresso machines 2026 |
| results |
Parameters
--querystringrequiredThe search query to look up on the web. e.g. "best espresso machines 2026"
Marketplace
Publish this collector so others can deploy it — you keep ownership.
0 runs in 14d · published 6h ago
Versions
Every build and self-heal appends a version. Pin one to lock runs to it.
v1builtapprovedcurrent6h ago
How this script collects data
import Firecrawl from "@mendable/firecrawl-js";
import { parseArgs } from "node:util";
const apiKey = process.env.FIRECRAWL_API_KEY;
if (!apiKey) {
console.error("FIRECRAWL_API_KEY is not set");
process.exit(1);
}
const firecrawl = new Firecrawl({ apiKey });
const { values } = parseArgs({
options: {
query: { type: "string" },
},
strict: true,
});
const query = values.query;
if (!query || query.trim() === "") {
console.error("OUT_OF_SCOPE: missing required --query parameter");
process.exit(1);
}
// Derive the displayed domain (host without leading "www.") from a URL.
function displayedDomain(url: string): string {
try {
const host = new URL(url).hostname;
return host.replace(/^www\./i, "");
} catch {
return "";
}
}
type WebResult = {
url?: string;
title?: string;
description?: string;
position?: number;
};
async function main() {
const result = await firecrawl.search(query as string, {
limit: 10,
sources: [{ type: "web" }],
integration: "prometheus",
});
const web = ((result as { web?: WebResult[] }).web ?? []).slice(0, 10);
const results = web.map((r, i) => {
const url = r.url ?? "";
return {
position: typeof r.position === "number" ? r.position : i + 1,
title: r.title ?? "",
url,
domain: displayedDomain(url),
snippet: r.description ?? "",
};
});
const out = { query, count: results.length, results };
process.stdout.write(JSON.stringify(out));
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
Deploy this collector to unlock schedules, the API endpoint, and destinations.