/driver Fix

This commit is contained in:
ssyyhhrr
2022-06-23 21:38:39 +01:00
parent a00e112b2c
commit 08b0526875

2
app.js
View File

@@ -86,6 +86,7 @@ async function main() {
} }
async function updateDrivers() { async function updateDrivers() {
drivers = {}
for (let i = 2000; i <= year; i++) { for (let i = 2000; i <= year; i++) {
console.log(`Scraping F1 ${i} Season...`) console.log(`Scraping F1 ${i} Season...`)
await axios.get(`http://ergast.com/api/f1/${i}/driverStandings.json?limit=1000`).then(res => { await axios.get(`http://ergast.com/api/f1/${i}/driverStandings.json?limit=1000`).then(res => {
@@ -126,7 +127,6 @@ function dotd() {
driver = getRandomProperty(drivers) driver = getRandomProperty(drivers)
console.log(`Driver of the Day is ${driver}!`) console.log(`Driver of the Day is ${driver}!`)
console.log(drivers[driver]) console.log(drivers[driver])
drivers = {}
} }
function getRandomProperty(obj) { function getRandomProperty(obj) {