import Debug from "debug"; import { writeFileSync } from "fs"; import { Cache } from "./cache"; import { ICSGenerator } from "./ics-generator"; import { Calendar, Event, Language, PageData, Sport, Team } from "./types"; const BASE_URL = "https://www.olympics.com"; const BASE_SCHEDULE_PATH = "milano-cortina-2026/schedule/overview"; export class Scraper { private cache = new Cache(); private debug = Debug("olympics-calendar:scraper"); private events: Event[] = []; private languages: Language[] = []; private nocs: Team[] = []; private sports: Sport[] = []; private async getPageData(path: string): Promise { this.debug(`getPageData: path=${path}`); if (!this.cache.has(path)) { const url = `${BASE_URL}${path}`; const response = await fetch(url); const page = await response.text(); const dataMatch = page.match( /