EXTRACT API ALWAYS GET SAME EMPTY RESPONSE:

{ success: true, data: {}, warning: undefined, error: undefined, sources: undefined }, async robustSearch(firecrawl, context) { let productSuggestion: any[] = []; const schema = z.object({ products: z .array( z.object({ url: z.string().optional(), price: z.string().optional(), image_url: z.string().optional(), title: z.string().optional(), }), ) .optional(), }); try { productSuggestion = await Promise.all( context.map(async (item) => { const prompt = sugestoes de presente até ${item.precoMax} do produto "${item.produto}", A url precisa ser de fato de um produto, precisa ter o preço disponivel e disponibilizar uma url do link de uma imagem do produto. ; console.log('Processing item:', item.urlBusca); console.log('Prompt:', prompt); return await firecrawl.extract([item.urlBusca], { prompt, schema, enableWebSearch: true, }); }), ); } catch (error) { console.error('Error during Firecrawl extraction:', error); } console.log('Product suggestions:', productSuggestion); return productSuggestion; } @Caleb
3 Replies
Julian Flieller
Julian Flieller5mo ago
Hey @EnKaizer I´ve attached an .js file with a working version for you. just run:
npm i
node test.js
npm i
node test.js
I have also attached a response.json for my test case. If you need any more help, feel free to DM me, happy to help! 🙂
EnKaizer
EnKaizerOP5mo ago
so pretty much is just enable the web search? i didnt want to take so much cost to do these crawler! but thx a lot for your help

Did you find this page helpful?