Skip to content

Instantly share code, notes, and snippets.

@yoeven
Created May 25, 2025 01:25
Show Gist options
  • Save yoeven/13ea842dc9f17522778bdc0b219e8d4c to your computer and use it in GitHub Desktop.
Save yoeven/13ea842dc9f17522778bdc0b219e8d4c to your computer and use it in GitHub Desktop.
Firecrawl vs JigsawStack
import FirecrawlApp from "@mendable/firecrawl-js";
import { JigsawStack } from "jigsawstack";
import { z } from "zod";
import fs from "fs";
const firecrawl = new FirecrawlApp({ apiKey: "your-api-key" });
const jigsaw = JigsawStack({
apiKey: "your-api-key",
});
const run = async (url: string, prompts: string[]) => {
const jigsawStartTime = performance.now();
const jigsawResult = await jigsaw.web
.ai_scrape({
element_prompts: prompts,
url,
})
.catch((err) => {
return {
err: err?.message,
};
});
const jigsawTimeTaken = performance.now() - jigsawStartTime;
console.log(`Jigsaw time taken: ${jigsawTimeTaken}ms`);
fs.writeFileSync(
`fire/jigsawstack-${new URL(url).hostname}.json`,
JSON.stringify(
{
result: jigsawResult,
timeTaken: jigsawTimeTaken,
prompt: prompts,
url,
},
null,
2
)
);
const fireStartTime = performance.now();
const scrapeResult = await firecrawl
.scrapeUrl(url, {
formats: ["json"],
jsonOptions: {
schema: z.object({
...prompts.reduce((acc: any, prompt) => {
acc[prompt] = z.array(z.string());
return acc;
}, {}),
}),
},
proxy: "stealth",
})
.catch((err) => {
return {
err: err?.message,
};
});
const fireTimeTaken = performance.now() - fireStartTime;
console.log(`Firecrawl time taken: ${fireTimeTaken}ms`);
fs.writeFileSync(
`fire/firecrawl-${new URL(url).hostname}.json`,
JSON.stringify(
{
result: scrapeResult,
timeTaken: fireTimeTaken,
prompt: prompts,
url,
},
null,
2
)
);
};
run("https://startups.gallery/investors", ["listing_names"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment