import FirecrawlApp from '@mendable/firecrawl-js';
import { GoogleGenAI, Type } from '@google/genai';
const firecrawl = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const scrapeResult = await firecrawl.scrape('https://stripe.com', {
formats: ['markdown']
});
console.log('Scraped content length:', scrapeResult.markdown?.length);
const response = await ai.models.generateContent({
model: 'gemini-2.5-flash',
contents: `Extract company information: ${scrapeResult.markdown}`,
config: {
responseMimeType: 'application/json',
responseSchema: {
type: Type.OBJECT,
properties: {
name: { type: Type.STRING },
industry: { type: Type.STRING },
description: { type: Type.STRING },
products: {
type: Type.ARRAY,
items: { type: Type.STRING }
}
},
propertyOrdering: ['name', 'industry', 'description', 'products']
}
}
});
console.log('Extracted company info:', response?.text);