Created
January 5, 2022 21:09
-
-
Save duncte123/664911c2f026517a3cfd97cef201d5ea to your computer and use it in GitHub Desktop.
Fetch oengus schedule to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.npmjs.com/package/ky | |
const ky = require('ky'); | |
const fs = require('fs'); | |
const MARATHON_ID = ''; | |
// can be found in devtools (f12) -> application -> localstorage -> oengus.io -> token | |
const TOKEN = ''; | |
async function downloadSchedule() { | |
const json = await ky.get(`https://oengus.io/api/marathons/${MARATHON_ID}/schedule`, { | |
headers: { | |
'Authorization': `Bearer ${TOKEN.trim()}`, | |
}, | |
}).json(); | |
fs.writeFileSync('./oengus-schedule.json', JSON.stringify(json, null, 2)) | |
} | |
if (MARATHON_ID && TOKEN) { | |
downloadSchedule(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment