File tree Expand file tree Collapse file tree 4 files changed +18
-21
lines changed Expand file tree Collapse file tree 4 files changed +18
-21
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
dist
3
3
junk * log.env
4
+
5
+ src /index.ts
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,13 +13,15 @@ export const getDriverLineup = async (): Promise<isDriver[]> => {
13
13
const $ = cheerio . load ( response . data ) ;
14
14
15
15
// drivers with ranking
16
- $ ( "a.focus-visible\\:outline-0" ) . each ( function ( ) {
17
- const firstName : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
18
- const secondName : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > p:nth-child(2)" ) . text ( ) . trim ( ) ;
19
- const team : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > p:nth-child(5)" ) . text ( ) ;
20
- const rank : string | undefined = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
21
- const nationalityImage : string | undefined = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > img:nth-child(2)" ) . attr ( "src" ) ;
22
- const driverImage : string | undefined = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(1) > div:nth-child(6) > img:nth-child(2)" ) . attr ( "src" ) ;
16
+ $ ( "a[data-f1rd-a7s-click=driver_card_click]" ) . each ( function ( index : number ) {
17
+ const firstName : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(4) > p:nth-child(1)" ) . text ( ) . trim ( ) ;
18
+ const secondName : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(4) > p:nth-child(2)" ) . text ( ) . trim ( ) ;
19
+ const team : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(4) > div:nth-child(3) > p:nth-child(1)" ) . text ( ) ;
20
+ const rank : string | undefined = String ( ++ index ) ;
21
+
22
+ //Updated to retrieve SVG due to switch to SVG flags
23
+ const nationalityImage : string = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(6)" ) . html ( ) || "" ;
24
+ const driverImage : string | undefined = $ ( this ) . find ( "div:nth-child(1) > div:nth-child(7) > div:nth-child(1) > img" ) . attr ( "src" ) ;
23
25
24
26
if ( firstName . length !== 0 && secondName . length !== 0 && team . length !== 0 && rank ?. length !== 0 && nationalityImage ?. length !== 0 && driverImage ?. length !== 0 ) {
25
27
const driver : isDriver = {
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
- export { getTeamLineup } from "./scraper/team-lineup" ;
4
- export { getDriverStandings } from "./scraper/driver-standings" ;
5
- export { getConstructorStandings } from "./scraper/constructors-standings" ;
6
- export { getWorldChampions } from "./scraper/world-champions" ;
7
- export { getRaceResults } from "./scraper/race-results" ;
8
- export { getRaceSchedule } from "./scraper/race-schedule" ;
3
+ // export { getTeamLineup } from "./scraper/team-lineup";
4
+ // export { getDriverStandings } from "./scraper/driver-standings";
5
+ // export { getConstructorStandings } from "./scraper/constructors-standings";
6
+ // export { getWorldChampions } from "./scraper/world-champions";
7
+ // export { getRaceResults } from "./scraper/race-results";
8
+ // export { getRaceSchedule } from "./scraper/race-schedule";
You can’t perform that action at this time.
0 commit comments