chore: sync with Gitea master and restore local-only files
Reset local main to gitea/master (new source of truth) and restored local-only files: web scrapers, admin dashboard, ChromaDB integration, debug scripts, and utility libraries that aren't tracked in Gitea. Gitea master adds: discovermass, buscarmisas-network, hk-parishes, bohosluzby, kerknet, gottesdienstzeiten, miserend importers, ClaimRequest model, forward geocoding, heartbeat healthcheck. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
74
scripts/debug/debug-paroquia-paz.ts
Normal file
74
scripts/debug/debug-paroquia-paz.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env tsx
|
||||
/**
|
||||
* Deep dive into Paróquia da Paz parsing bug
|
||||
*/
|
||||
|
||||
import { GenericScraper } from '../../src/scrapers/strategies/generic';
|
||||
|
||||
async function debugPaz() {
|
||||
const url = 'https://www.paroquiadapaz.org.br/';
|
||||
console.log(`Debugging: ${url}\n`);
|
||||
|
||||
const scraper = new GenericScraper();
|
||||
await scraper.init();
|
||||
scraper.setCountry('BR');
|
||||
|
||||
const result = await scraper.scrape(url);
|
||||
|
||||
console.log(`Success: ${result.success}`);
|
||||
console.log(`Schedules: ${result.schedules.length}\n`);
|
||||
|
||||
if (result.rawHtml) {
|
||||
const text = result.rawHtml
|
||||
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
||||
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
||||
.replace(/<[^>]+>/g, ' ')
|
||||
.replace(/\s+/g, ' ')
|
||||
.toLowerCase();
|
||||
|
||||
// Find where days appear
|
||||
console.log('=== Finding day + time patterns ===\n');
|
||||
|
||||
const days = ['domingo', 'segunda', 'terça', 'terca', 'quarta', 'quinta', 'sexta', 'sábado', 'sabado'];
|
||||
|
||||
for (const day of days) {
|
||||
const dayIndex = text.indexOf(day);
|
||||
if (dayIndex !== -1) {
|
||||
// Show context around the day (100 chars before and 200 after)
|
||||
const before = Math.max(0, dayIndex - 100);
|
||||
const after = Math.min(text.length, dayIndex + 200);
|
||||
const snippet = text.substring(before, after);
|
||||
|
||||
console.log(`${day.toUpperCase()}:`);
|
||||
console.log(` Position: ${dayIndex}`);
|
||||
console.log(` Context: ...${snippet}...`);
|
||||
console.log('');
|
||||
}
|
||||
}
|
||||
|
||||
// Check for "h" time format specifically
|
||||
console.log('\n=== Checking "h" time format ===');
|
||||
const hTimeRegex = /(\d{1,2})h(\d{2})?/g;
|
||||
const hTimes = text.match(hTimeRegex);
|
||||
if (hTimes) {
|
||||
console.log(`Found ${hTimes.length} "h" format times:`);
|
||||
console.log(hTimes.slice(0, 30).join(', '));
|
||||
}
|
||||
|
||||
// Look for schedule structure
|
||||
console.log('\n=== Looking for schedule structure ===');
|
||||
const scheduleKeywords = ['horário', 'horario', 'missa', 'missas', 'santa missa'];
|
||||
for (const keyword of scheduleKeywords) {
|
||||
const index = text.indexOf(keyword);
|
||||
if (index !== -1) {
|
||||
const snippet = text.substring(index, Math.min(text.length, index + 500));
|
||||
console.log(`\nFound "${keyword}" at position ${index}:`);
|
||||
console.log(snippet.substring(0, 300));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await scraper.close();
|
||||
}
|
||||
|
||||
debugPaz().catch(console.error);
|
||||
Reference in New Issue
Block a user