File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,16 @@ export const getFastestLaps = async (year: number = new Date().getFullYear()): P
11
11
12
12
const response = await axios ( `${ dynamicLinks . rootLink } /${ year } /${ dynamicLinks . fastestLap } ` ) ;
13
13
const $ = cheerio . load ( response . data ) ;
14
+ console . log ( `${ dynamicLinks . rootLink } /${ year } /${ dynamicLinks . fastestLap } ` ) ;
14
15
15
16
$ ( ".f1-table > tbody:nth-child(2) > tr" ) . each ( function ( ) {
16
- const grandPrix : string = $ ( this ) . find ( "td:nth-child(1) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
17
- const driverFirstName : string = $ ( this ) . find ( "td:nth-child(2) > p:nth-child(1) > span:nth-child(1)" ) . text ( ) . trim ( ) ;
18
- const driverLastName : string = $ ( this ) . find ( "td:nth-child(2) > p:nth-child(1) > span:nth-child(2 )" ) . text ( ) . trim ( ) ;
17
+ const grandPrixAll : Text = $ ( this ) . find ( "td:nth-child(1) > p:nth-child(1) > a " ) . contents ( ) . get ( ) [ 1 ] ;
18
+ const grandPrix : string = $ ( grandPrixAll ) . text ( ) ;
19
+ const driverName : string = $ ( this ) . find ( "td:nth-child(2) > p:nth-child(1) > span:nth-child(1 )" ) . text ( ) . trim ( ) ;
19
20
const car : string = $ ( this ) . find ( "td:nth-child(3) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
20
21
const time : string = $ ( this ) . find ( "td:nth-child(4) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
21
22
22
- const driver : string = driverFirstName . concat ( " " , driverLastName ) ;
23
+ const driver : string = driverName . slice ( 0 , driverName . length - 3 ) ;
23
24
24
25
if ( driver . length !== 0 && grandPrix . length !== 0 && car . length !== 0 && time . length !== 0 ) {
25
26
const fastestLap : isFastestLap = {
Original file line number Diff line number Diff line change 1
- // export { getFastestLaps } from "./scraper/fastest-laps";
1
+ export { getFastestLaps } from "./scraper/fastest-laps" ;
2
2
export { getDriverLineup } from "./scraper/driver-lineup" ;
3
3
// export { getTeamLineup } from "./scraper/team-lineup";
4
4
// export { getDriverStandings } from "./scraper/driver-standings";
You can’t perform that action at this time.
0 commit comments