File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,31 @@ const fetch = (...args) =>
88async function getFormulaOneDrivers ( ) {
99 console . log ( "Getting Formula One Drivers..." ) ;
1010
11- const response = await fetch ( "https://www.formula1.com/en/drivers.html" ) ;
11+ const urls = [
12+ "https://www.formula1.com/en/latest.html" ,
13+ "https://www.formula1.com/en/results.html/2022/drivers.html" ,
14+ "https://www.formula1.com/en/results.html/2022/team.html" ,
15+ ] ;
16+
17+ const url = "https://www.formula1.com/en/drivers.html" ;
18+
19+ const response = await fetch ( url ) ;
1220 const body = await response . text ( ) ;
1321 const $ = cheerio . load ( body ) ;
1422
23+ // go through each url and get the body of the page
24+ const promises = urls . map ( async ( url ) => {
25+ const response = await fetch ( url ) ;
26+ const body = await response . text ( ) ;
27+ return body ;
28+ } ) ;
29+
30+ const bodies = await Promise . all ( promises ) ;
31+
32+ bodies . map ( ( body ) => {
33+ console . log ( "BODY: " , body ) ;
34+ } ) ;
35+
1536 // ============================================================================= \\
1637 // ============================================================================= \\
1738 // - - - - - - - - - - - C O R E L O G I C S T A R T - - - - - - - - - - - ||
You can’t perform that action at this time.
0 commit comments