paddockpass/crawlers/races.go
2020-07-26 01:41:30 +02:00

71 lines
913 B
Go

package crawlers
// GetResultsFromErgast retrieves the results of the races from Ergast API.
// func GetResultsFromErgast(year string) {
// resp, err := http.Get("http://ergast.com/api/f1/results" + year + ".json")
// if err != nil {
// panic(err.Error())
// }
// body, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// panic(err.Error())
// }
// defer resp.Body.Close()
// var jsonData MRData
// err = json.Unmarshal(body, &jsonData)
// if err != nil {
// logrus.Error(err)
// }
// fmt.Println(jsonData)
// }
/**
MRDATA {
RaceTable {
Races [
{
season
round
url
raceName
date
time
Circuit {
},
Results " [
number,
position,
points,
Driver {}
Constructor {}
grid
laps
status
Time {
millis
time
}
FastestLap {
rank
lap
Time {
time
}
AverageSpeed {
units
speed
}
}
]"
}
]
}
}
**/