54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
const { scrapePBTechCPUs } = require('./scrapers/pbtech');
|
|
const { fetchBenchmarkData, findBenchmarkScore } = require('./scrapers/cpubenchmark');
|
|
|
|
async function testAllMatches() {
|
|
console.log('Fetching CPUs from PB Tech...');
|
|
const cpus = await scrapePBTechCPUs(console.log);
|
|
|
|
console.log('\nFetching benchmark data...');
|
|
const benchmarkData = await fetchBenchmarkData(console.log);
|
|
|
|
console.log(`\n=== Testing ${cpus.length} CPUs ===\n`);
|
|
|
|
const matched = [];
|
|
const unmatched = [];
|
|
|
|
cpus.forEach(cpu => {
|
|
const score = findBenchmarkScore(cpu.name, benchmarkData);
|
|
if (score) {
|
|
matched.push({ ...cpu, score });
|
|
} else {
|
|
unmatched.push(cpu);
|
|
}
|
|
});
|
|
|
|
console.log(`✅ Matched: ${matched.length}/${cpus.length}`);
|
|
console.log(`❌ Unmatched: ${unmatched.length}/${cpus.length}\n`);
|
|
|
|
if (unmatched.length > 0) {
|
|
console.log('=== UNMATCHED CPUs (first 10) ===');
|
|
unmatched.slice(0, 10).forEach(cpu => {
|
|
console.log(`\nName: ${cpu.name.substring(0, 80)}`);
|
|
console.log(`Price: $${cpu.price}`);
|
|
|
|
// Try to find similar CPUs in the benchmark database
|
|
const searchTerms = cpu.name.match(/\b(Ryzen|Core|Threadripper|Pentium|Celeron|Athlon)\s+\w+\s+\w+/i);
|
|
if (searchTerms) {
|
|
const similar = Object.keys(benchmarkData)
|
|
.filter(name => name.toLowerCase().includes(searchTerms[0].toLowerCase().split(' ')[0]))
|
|
.slice(0, 3);
|
|
if (similar.length > 0) {
|
|
console.log(`Similar in DB: ${similar.join(', ')}`);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
console.log('\n=== SUCCESSFULLY MATCHED (first 10) ===');
|
|
matched.slice(0, 10).forEach(cpu => {
|
|
console.log(`${cpu.name.substring(0, 60)}... → ${cpu.score} (${(cpu.score / cpu.price).toFixed(2)} perf/$)`);
|
|
});
|
|
}
|
|
|
|
testAllMatches().catch(console.error);
|