(html: string, key: string)
| 95 | } |
| 96 | |
| 97 | function extractWindowNumber(html: string, key: string): number | null { |
| 98 | const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 99 | const regex = new RegExp(`${escapedKey}\\s*=\\s*([0-9]+(?:\\.[0-9]+)?)`, "i"); |
| 100 | const match = html.match(regex); |
| 101 | if (!match) return null; |
| 102 | return parseNum(match[1]); |
| 103 | } |
| 104 | |
| 105 | function normalizeDurationSeconds( |
| 106 | rawDuration: number | null, |