Compare commits
No commits in common. "70aa6c0dd29709d7ce48fec2dcc00b02f29ee196" and "1a9742f92109c61a4faff1f015f0edfa4d311e31" have entirely different histories.
70aa6c0dd2
...
1a9742f921
6 changed files with 21 additions and 198 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,4 +14,3 @@ tmp
|
||||||
config/client_google_auth.json
|
config/client_google_auth.json
|
||||||
|
|
||||||
## output ##
|
## output ##
|
||||||
dist
|
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
BEGIN:VCALENDAR
|
|
||||||
VERSION:2.0
|
|
||||||
CALSCALE:GREGORIAN
|
|
||||||
PRODID:https://mhaifafc.com/
|
|
||||||
METHOD:PUBLISH
|
|
||||||
X-PUBLISHED-TTL:PT1H
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:Od0AeXkvLYZ2ELyVyCf3w
|
|
||||||
SUMMARY:Maccabi Haifa F.C.
|
|
||||||
DTSTAMP:20230402T123647Z
|
|
||||||
DTSTART:20230404T173000Z
|
|
||||||
DTEND:20230404T193000Z
|
|
||||||
DESCRIPTION:Maccabi Tel aviv vs. Maccabi Haifa
|
|
||||||
URL:https://mhaifafc.com/
|
|
||||||
LOCATION:Sammy Ofer Stadium
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
CATEGORIES:
|
|
||||||
ORGANIZER;CN=Maccabi Haifa F.C.
|
|
||||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
|
||||||
END:VEVENT
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:OCMexF1apX1IoP8K9qHCQ
|
|
||||||
SUMMARY:Maccabi Haifa F.C.
|
|
||||||
DTSTAMP:20230402T123647Z
|
|
||||||
DTSTART:20230408T170000Z
|
|
||||||
DTEND:20230408T190000Z
|
|
||||||
DESCRIPTION:Maccabi Haifa vs. Maccabi Netanya
|
|
||||||
URL:https://mhaifafc.com/
|
|
||||||
LOCATION:Sammy Ofer Stadium
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
CATEGORIES:
|
|
||||||
ORGANIZER;CN=Maccabi Haifa F.C.
|
|
||||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
|
||||||
END:VEVENT
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:4Qab1aW2S5xDL3OC-3_sA
|
|
||||||
SUMMARY:Maccabi Haifa F.C.
|
|
||||||
DTSTAMP:20230402T123647Z
|
|
||||||
DTSTART:20230415T153000Z
|
|
||||||
DTEND:20230415T173000Z
|
|
||||||
DESCRIPTION:Hapoel Jerusalem vs. Maccabi Haifa
|
|
||||||
URL:https://mhaifafc.com/
|
|
||||||
LOCATION:Sammy Ofer Stadium
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
CATEGORIES:
|
|
||||||
ORGANIZER;CN=Maccabi Haifa F.C.
|
|
||||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
|
||||||
END:VEVENT
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:N3At5VutrWAUaQiaNkwm6
|
|
||||||
SUMMARY:Maccabi Haifa F.C.
|
|
||||||
DTSTAMP:20230402T123647Z
|
|
||||||
DTSTART:20230423T173000Z
|
|
||||||
DTEND:20230423T193000Z
|
|
||||||
DESCRIPTION:F.C Ashdod vs. Maccabi Haifa
|
|
||||||
URL:https://mhaifafc.com/
|
|
||||||
LOCATION:Sammy Ofer Stadium
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
CATEGORIES:
|
|
||||||
ORGANIZER;CN=Maccabi Haifa F.C.
|
|
||||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
|
||||||
END:VEVENT
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:QTleUThXSlGWTOZo2moK5
|
|
||||||
SUMMARY:Maccabi Haifa F.C.
|
|
||||||
DTSTAMP:20230402T123647Z
|
|
||||||
DTSTART:20230501T173000Z
|
|
||||||
DTEND:20230501T193000Z
|
|
||||||
DESCRIPTION:H Be'er Sheva vs. Maccabi Haifa
|
|
||||||
URL:https://mhaifafc.com/
|
|
||||||
LOCATION:Sammy Ofer Stadium
|
|
||||||
STATUS:CONFIRMED
|
|
||||||
CATEGORIES:
|
|
||||||
ORGANIZER;CN=Maccabi Haifa F.C.
|
|
||||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
|
||||||
END:VEVENT
|
|
||||||
END:VCALENDAR
|
|
88
package-lock.json
generated
88
package-lock.json
generated
|
@ -6,7 +6,6 @@
|
||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
"cron": "^2.3.0",
|
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"googleapis": "^113.0.0",
|
"googleapis": "^113.0.0",
|
||||||
|
@ -15,7 +14,6 @@
|
||||||
"node-html-parser": "^6.1.5"
|
"node-html-parser": "^6.1.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.17",
|
|
||||||
"@types/node": "^18.15.5"
|
"@types/node": "^18.15.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -30,87 +28,17 @@
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/body-parser": {
|
|
||||||
"version": "1.19.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
|
|
||||||
"integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/connect": "*",
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/connect": {
|
|
||||||
"version": "3.4.35",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
|
|
||||||
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/express": {
|
|
||||||
"version": "4.17.17",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
|
|
||||||
"integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/body-parser": "*",
|
|
||||||
"@types/express-serve-static-core": "^4.17.33",
|
|
||||||
"@types/qs": "*",
|
|
||||||
"@types/serve-static": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/express-serve-static-core": {
|
|
||||||
"version": "4.17.33",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.33.tgz",
|
|
||||||
"integrity": "sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "*",
|
|
||||||
"@types/qs": "*",
|
|
||||||
"@types/range-parser": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/lodash": {
|
"node_modules/@types/lodash": {
|
||||||
"version": "4.14.192",
|
"version": "4.14.192",
|
||||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.192.tgz",
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.192.tgz",
|
||||||
"integrity": "sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A=="
|
"integrity": "sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/mime": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.15.5",
|
"version": "18.15.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
|
||||||
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
|
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/qs": {
|
|
||||||
"version": "6.9.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
|
|
||||||
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/range-parser": {
|
|
||||||
"version": "1.2.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
|
|
||||||
"integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@types/serve-static": {
|
|
||||||
"version": "1.15.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
|
|
||||||
"integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/mime": "*",
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/accepts": {
|
"node_modules/accepts": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||||
|
@ -312,14 +240,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||||
},
|
},
|
||||||
"node_modules/cron": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cron/-/cron-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-ZN5HP8zDY41sJolMsbc+GksRATcbvkPKF5wR/qc8FrV4NBVi9ORQa1HmYa5GydaysUB80X9XpRlRkooa5uEtTA==",
|
|
||||||
"dependencies": {
|
|
||||||
"luxon": "^3.2.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/css-select": {
|
"node_modules/css-select": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
|
||||||
|
@ -914,14 +834,6 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/luxon": {
|
|
||||||
"version": "3.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.3.0.tgz",
|
|
||||||
"integrity": "sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/media-typer": {
|
"node_modules/media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
"cron": "^2.3.0",
|
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"googleapis": "^113.0.0",
|
"googleapis": "^113.0.0",
|
||||||
|
@ -15,7 +14,6 @@
|
||||||
"start": "node dist/index.js"
|
"start": "node dist/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.17",
|
|
||||||
"@types/node": "^18.15.5"
|
"@types/node": "^18.15.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
src/WebServer.ts
Normal file
14
src/WebServer.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Create a webserver with express
|
||||||
|
// This is the main webserver for the application
|
||||||
|
// It is responsible for serving the static files and the API
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import express from 'express'
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
app.use(express.static('public'))
|
||||||
|
|
||||||
|
app.listen(3000, () => {
|
||||||
|
console.log('Example app listening on port 3000!')
|
||||||
|
})
|
29
src/index.ts
29
src/index.ts
|
@ -2,10 +2,6 @@ import GoogleCalendar from './GoogleCalendar';
|
||||||
import GameSource from './GameSource';
|
import GameSource from './GameSource';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import Ics from './Ics';
|
import Ics from './Ics';
|
||||||
import express from 'express'
|
|
||||||
|
|
||||||
|
|
||||||
const CronJob = require('cron').CronJob;
|
|
||||||
|
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
|
@ -34,31 +30,12 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
const app = new App();
|
const app = new App();
|
||||||
console.log("Declaring Cron Job every day at 10:00")
|
|
||||||
|
|
||||||
const cron = "0 10 * * *" // every day at 10:00
|
const start = async () => {
|
||||||
|
|
||||||
const job = new CronJob(
|
|
||||||
"* * * * *",
|
|
||||||
async () => {
|
|
||||||
console.log("START")
|
|
||||||
const outputFileLocation = 'public/maccabi-haifa-fc.ics';
|
const outputFileLocation = 'public/maccabi-haifa-fc.ics';
|
||||||
const games = await app.gameSource.getGamesFromHaifa();
|
const games = await app.gameSource.getGamesFromHaifa();
|
||||||
const icsEvents = app.ics.generateIcsOutputFromGames(games);
|
const icsEvents = app.ics.generateIcsOutputFromGames(games);
|
||||||
fs.writeFileSync(outputFileLocation, icsEvents);
|
fs.writeFileSync(outputFileLocation, icsEvents);
|
||||||
console.log("END")
|
}
|
||||||
},
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
'Asia/Jerusalem'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
start();
|
||||||
|
|
||||||
|
|
||||||
const webServer = express();
|
|
||||||
webServer.use(express.static('public'))
|
|
||||||
|
|
||||||
webServer.listen(3000, () => {
|
|
||||||
console.log('Example app listening on port 3000!')
|
|
||||||
})
|
|
Loading…
Reference in a new issue