mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-17 06:13:40 -05:00
2023 Fix
This commit is contained in:
4
app.js
4
app.js
@@ -120,6 +120,7 @@ async function updateDrivers() {
|
|||||||
drivers = {}
|
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...`)
|
||||||
|
try {
|
||||||
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 => {
|
||||||
res.data.MRData.StandingsTable.StandingsLists[0].DriverStandings.forEach(driver => {
|
res.data.MRData.StandingsTable.StandingsLists[0].DriverStandings.forEach(driver => {
|
||||||
if (driver.Driver.driverId in drivers) {
|
if (driver.Driver.driverId in drivers) {
|
||||||
@@ -140,6 +141,9 @@ async function updateDrivers() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
} catch (e) {
|
||||||
|
if (i !== year) throw ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs.existsSync("assets/drivers.json")) {
|
if (fs.existsSync("assets/drivers.json")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user