Skip to content

Instantly share code, notes, and snippets.

@duncte123
Created January 5, 2022 21:09
Show Gist options
  • Save duncte123/664911c2f026517a3cfd97cef201d5ea to your computer and use it in GitHub Desktop.
Save duncte123/664911c2f026517a3cfd97cef201d5ea to your computer and use it in GitHub Desktop.
Fetch oengus schedule to file
// 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