-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-scraper.js
More file actions
45 lines (37 loc) · 1.45 KB
/
Copy pathtest-scraper.js
File metadata and controls
45 lines (37 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Simple test script for tender scraper
const { scrapeAllSources } = require('./src/lib/tenderScraper.ts');
async function testScraper() {
console.log('Testing tender scraper...');
try {
const startTime = Date.now();
const tenders = await scrapeAllSources();
const endTime = Date.now();
console.log(`\n✅ Scraper test completed in ${endTime - startTime}ms`);
console.log(`📊 Found ${tenders.length} tenders total`);
if (tenders.length > 0) {
console.log('\n📋 Sample tenders:');
tenders.slice(0, 3).forEach((tender, i) => {
console.log(`\n${i + 1}. ${tender.title}`);
console.log(` Ref: ${tender.reference_number}`);
console.log(` Source: ${tender.source}`);
console.log(` Department: ${tender.department}`);
console.log(` Closing: ${tender.closing_date}`);
console.log(` Description: ${tender.description?.slice(0, 100)}...`);
});
}
// Count by source
const sourceCounts = {};
tenders.forEach(t => {
sourceCounts[t.source] = (sourceCounts[t.source] || 0) + 1;
});
console.log('\n📈 Tenders by source:');
Object.entries(sourceCounts)
.sort(([,a], [,b]) => b - a)
.forEach(([source, count]) => {
console.log(` ${source}: ${count}`);
});
} catch (error) {
console.error('❌ Scraper test failed:', error.message);
}
}
testScraper();