Skip to main content
Glama
josuekongolo

CompanyIQ MCP Server

by josuekongolo
test-headless.jsβ€’2.54 kB
import dotenv from 'dotenv'; dotenv.config(); import { BrowserScraper } from './build/scraper/browser_scraper.js'; async function testHeadlessScraper() { console.log('πŸ€– Testing HEADLESS Browser Scraper'); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); console.log('βœ… Browser will run invisibly in background'); console.log(' No Chrome window will appear\n'); const apiKey = process.env.OPENAI_API_KEY; if (!apiKey) { console.error('❌ OPENAI_API_KEY not found!'); process.exit(1); } const scraper = new BrowserScraper(apiKey, '999059198'); const orgNr = '999059198'; // Test company console.log(`πŸ“Š Starting headless scraping for company ${orgNr}...`); console.log('⏳ This will take 30-60 seconds...\n'); try { const startTime = Date.now(); // This should run completely in the background const results = await scraper.getAllFinancialYears(orgNr); const duration = Math.round((Date.now() - startTime) / 1000); console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'); console.log('βœ… HEADLESS SCRAPING COMPLETE!'); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); console.log(`⏱️ Time taken: ${duration} seconds`); console.log(`πŸ“Š Years processed: ${results.length}`); const withData = results.filter(r => r.revenue !== null || r.profit !== null); console.log(`βœ… Years with data: ${withData.length}`); if (withData.length > 0) { console.log('\nπŸ“ˆ Sample results:'); withData.slice(0, 3).forEach(r => { const revenue = r.revenue ? (r.revenue/1000000).toFixed(1) + 'M' : 'N/A'; const profit = r.profit ? (r.profit/1000000).toFixed(1) + 'M' : 'N/A'; console.log(` ${r.year}: Revenue=${revenue}, Profit=${profit}`); }); } console.log('\nπŸŽ‰ Headless mode working perfectly!'); console.log(' No browser window was shown'); console.log(' All PDFs downloaded in background'); console.log(' Data extracted successfully'); } catch (error) { console.error('❌ Headless scraping failed:', error.message || error); console.error('\nThis might indicate:'); console.error('- Headless mode compatibility issue'); console.error('- Download path problems in headless mode'); } } testHeadlessScraper();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/josuekongolo/companyiq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server