diff --git a/src/GameSource.ts b/src/GameSource.ts index defa4ea..dcc88a0 100644 --- a/src/GameSource.ts +++ b/src/GameSource.ts @@ -10,15 +10,6 @@ import moment from 'moment'; // require export default class GameSource { constructor() { } - async getGamesFromSerapi() { - console.log("GET GAMES") - const sourceUrl = `https://serpapi.com/search.json?q=maccabi+haifa+next+games&api_key=${process.env.SERPAPI_KEY}&location=austin,+texas,+united+states`; - const result = await axios.get(sourceUrl) - - const games = this.orderGames(result) - return games; - } - async getGamesFromHaifa() { const sourceUrl = `https://mhaifafc.com/games?lang=en`; const result = await axios.get(sourceUrl); @@ -63,46 +54,6 @@ export default class GameSource { return games; } - orderGames(result: any) { - const rootGames = result.data.sports_results; - const upcomingEvents: GoogleCalendarEvent[] = []; - upcomingEvents.push({ - summary: rootGames.title, - location: rootGames.game_spotlight.stadium, - description: "Haifa vs. " + rootGames.game_spotlight.teams[this.getOpponentIndexByStadium(rootGames.game_spotlight.stadium)].name, - start: { - dateTime: `2023-03-22T09:00:00`, - timeZone: 'Asia/Jerusalem' - }, - end: { - dateTime: `2023-03-22T11:00:00`, - timeZone: 'Asia/Jerusalem' - } - }); - - // console.log(rootGames.game_spotlight) - // console.log("DONE WITH UPDATING NEW EVENTS") - - - rootGames.games.forEach((game: any) => { - upcomingEvents.push({ - summary: 'Maccabi Haifa F.C.', - location: game.stadium, - description: "Haifa vs. " + game.teams[this.getOpponentIndexByStadium(game.stadium)].name, - start: { - dateTime: `${game.date} ${game.time}`, - timeZone: 'Asia/Jerusalem' - }, - end: { - dateTime: `${game.date} ${game.time}`, - timeZone: 'Asia/Jerusalem' - } - }); - }); - // console.log("UPCOMING EVENTS", upcomingEvents) - return upcomingEvents; - } - getOpponentIndexByStadium(stadium: string) { if (stadium === "Sammy Ofer Stadium") { return 1; diff --git a/src/GoogleCalendar.ts b/src/GoogleCalendar.ts index 2a8e9f2..a93eea5 100644 --- a/src/GoogleCalendar.ts +++ b/src/GoogleCalendar.ts @@ -42,9 +42,6 @@ export default class GoogleCalendar { } async updateNewEvent(upcomingEvents: GoogleCalendarEvent[]) { - - - setTimeout(async () => { upcomingEvents.forEach((event: GoogleCalendarEvent) => { console.log("UPDATE NEW EVENT", upcomingEvents)