diff --git a/lib/feeds.ts b/lib/feeds.ts index 5b6f336..a516d5a 100644 --- a/lib/feeds.ts +++ b/lib/feeds.ts @@ -752,13 +752,25 @@ export function attachKOLiveData(matches: Match[], teams: Team[], koGames: Wc26G // Parst worldcup26-Scorer-String: "{\"Casemiro 56'\"}" oder "{\"Player 12'\",\"Other 34'\"}" function parseScorers(raw: string, team: "home" | "away", out: GoalEvent[]): void { + if (!raw || raw === "{}") return; const cleaned = raw.replace(/[{}"\\]/g, "").trim(); if (!cleaned) return; const parts = cleaned.split(","); for (const p of parts) { - const m = /^(.+?)\s+(\d+)'?\s*$/.exec(p.trim()); + const m = /^(.+?)\s+([0-9+]+)'?(?:\s*\(.*?\))?\s*$/.exec(p.trim()); if (m) { - out.push({ scorer: m[1].trim(), minute: parseInt(m[2], 10), team }); + const name = m[1].trim(); + const minStr = m[2]; + let minute = 0; + const plusIdx = minStr.indexOf("+"); + if (plusIdx >= 0) { + minute = parseInt(minStr.slice(0, plusIdx), 10) + parseInt(minStr.slice(plusIdx + 1), 10); + } else { + minute = parseInt(minStr, 10); + } + if (!isNaN(minute)) { + out.push({ scorer: name, minute, team }); + } } } } \ No newline at end of file