update
This commit is contained in:
@@ -167,7 +167,9 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
|
||||
const cells = Array.from(tr.querySelectorAll('td'));
|
||||
const val = (i: number) => {
|
||||
const a = cells[i]?.querySelector('a');
|
||||
return (a?.getAttribute('title') ?? cells[i]?.textContent ?? '').trim();
|
||||
const title = a?.getAttribute('title')?.trim();
|
||||
// Use title only if non-empty; otherwise fall back to textContent
|
||||
return (title || cells[i]?.textContent || '').trim();
|
||||
};
|
||||
const href = (tr.querySelector('a') as HTMLAnchorElement | null)?.href ?? null;
|
||||
return {
|
||||
@@ -186,10 +188,16 @@ async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
|
||||
);
|
||||
|
||||
log(`Parsed ${rows.length} rows from member table`);
|
||||
for (const row of rows) {
|
||||
log(` Row: StNr="${row.standesbuchNr}" Vorname="${row.vorname}" Zuname="${row.zuname}" Status="${row.status}"`);
|
||||
}
|
||||
|
||||
const members: FdiskMember[] = [];
|
||||
for (const row of rows) {
|
||||
if (!row.standesbuchNr || !row.vorname || !row.zuname) continue;
|
||||
if (!row.standesbuchNr || !row.vorname || !row.zuname) {
|
||||
log(` SKIP: StNr="${row.standesbuchNr}" Vorname="${row.vorname}" Zuname="${row.zuname}" — missing required field`);
|
||||
continue;
|
||||
}
|
||||
const abmeldedatum = parseDate(row.abmeldedatum);
|
||||
members.push({
|
||||
standesbuchNr: row.standesbuchNr,
|
||||
|
||||
Reference in New Issue
Block a user