Scraped Content
{result.markdown}
All interviewees eligible for the bounty reward have been contacted. Keep an eye on future bounties within our docs!
All interviewees eligible for the bounty reward have been contacted. Keep an eye on future bounties within our docs!
All interviewees eligible for the bounty reward have been contacted. Keep an eye on future bounties within our docs!
All interviewees eligible for the bounty reward have been contacted. Keep an eye on future bounties within our docs!
To qualify, complete a high-signal interview (thoughtful, concrete use cases, etc) with our Firecrawl Feedback Assistant. Only takes a few minutes, can be stopped at any time, and is both human/agent-friendly (just paste the link into your agentic harness!).
Start the interviewInclude your email to be eligible. Interviews are reviewed for quality at the end of each week.
Pass ?q= to search the web
)} ``` ## Scrape a page Create `src/pages/api/scrape.ts`: ```typescript theme={null} import type { APIRoute } from "astro"; import { Firecrawl } from "firecrawl"; const firecrawl = new Firecrawl({ apiKey: import.meta.env.FIRECRAWL_API_KEY, }); export const POST: APIRoute = async ({ request }) => { const { url } = await request.json(); const result = await firecrawl.scrape(url); return new Response(JSON.stringify(result), { headers: { "Content-Type": "application/json" }, }); }; ``` Or scrape at request time in a server-rendered page (`src/pages/scrape.astro`): ```astro theme={null} --- import { Firecrawl } from "firecrawl"; const firecrawl = new Firecrawl({ apiKey: import.meta.env.FIRECRAWL_API_KEY, }); const target = Astro.url.searchParams.get("url"); let markdown = null; if (target) { const result = await firecrawl.scrape(target); markdown = result.markdown; } ---{markdown} : Pass ?url= to scrape a page
} ``` ## Interact with a page Create `src/pages/api/interact.ts`: ```typescript theme={null} import type { APIRoute } from "astro"; import { Firecrawl } from "firecrawl"; const firecrawl = new Firecrawl({ apiKey: import.meta.env.FIRECRAWL_API_KEY, }); export const POST: APIRoute = async () => { const result = await firecrawl.scrape("https://www.amazon.com", { formats: ["markdown"], }); const scrapeId = result.metadata?.scrapeId; await firecrawl.interact(scrapeId, { prompt: "Search for iPhone 16 Pro Max", }); const response = await firecrawl.interact(scrapeId, { prompt: "Click on the first result and tell me the price", }); await firecrawl.stopInteraction(scrapeId); return new Response(JSON.stringify({ output: response.output }), { headers: { "Content-Type": "application/json" }, }); }; ``` ## Next steps{result.markdown}
{{ data.markdown }}
{markdown} : Pass ?url= to scrape a page
}{data.output}}
{data.markdown}
{:else}
Pass ?url= to scrape a page
{/if} ``` ## Interact with a page Create a server endpoint at `src/routes/api/interact/+server.ts`: ```typescript theme={null} import { json } from "@sveltejs/kit"; import { Firecrawl } from "firecrawl"; import { FIRECRAWL_API_KEY } from "$env/static/private"; const firecrawl = new Firecrawl({ apiKey: FIRECRAWL_API_KEY }); export async function POST() { const result = await firecrawl.scrape("https://www.amazon.com", { formats: ["markdown"], }); const scrapeId = result.metadata?.scrapeId; await firecrawl.interact(scrapeId, { prompt: "Search for iPhone 16 Pro Max", }); const response = await firecrawl.interact(scrapeId, { prompt: "Click on the first result and tell me the price", }); await firecrawl.stopInteraction(scrapeId); return json({ output: response.output }); } ``` ## Next steps