File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 1+ #  all node_modules
12node_modules 
23
34#  all txt files
Original file line number Diff line number Diff line change 1+ const  cheerio  =  require ( "cheerio" ) ; 
2+ 
3+ // work-around for "require" syntax from node-fetch"; 
4+ const  fetch  =  ( ...args )  => 
5+   import ( "node-fetch" ) . then ( ( {  default : fetch  } )  =>  fetch ( ...args ) ) ; 
6+ 
7+ async  function  getFormulaOneDrivers ( )  { 
8+   console . log ( "Getting Formula One Drivers..." ) ; 
9+ 
10+   const  response  =  await  fetch ( "https://www.formula1.com/en/drivers.html" ) ; 
11+   const  body  =  await  response . text ( ) ; 
12+   const  $  =  cheerio . load ( body ) ; 
13+ 
14+   // const wrapper = $(".listing-items--wrapper"); 
15+   // console.log("WRAPPER: ", wrapper.length); 
16+ 
17+   const  items  =  [ ] ; 
18+ 
19+   $ ( 
20+     ".listing-items--wrapper > .row > .col-12 > .listing-item--link > .listing-item--border > .container > .listing-item--head > .listing-item--name" 
21+   ) . map ( ( i ,  el )  =>  { 
22+     // insert space after first word 
23+     const  name  =  $ ( el ) . find ( ".f1-color--carbonBlack" ) . text ( ) ; 
24+     console . log ( "NAME: " ,  name ) ; 
25+   } ) ; 
26+ 
27+   try  { 
28+   }  catch  ( error )  { 
29+     console . log ( "ERROR: " ,  error ) ; 
30+   } 
31+ } 
32+ getFormulaOneDrivers ( ) ; 
Original file line number Diff line number Diff line change 22  "name" : " googlesearchblogscraper"  ,
33  "version" : " 1.0.0"  ,
44  "description" : " "  ,
5-   "main" : " googleSearchResults .js"  ,
5+   "main" : " index .js"  ,
66  "scripts" : {
77    "test" : " echo \" Error: no test specified\"  && exit 1" 
88  },
99  "keywords" : [
1010    " web"  ,
1111    " scraper"  ,
12-     " webscraper" 
12+     " webscraper"  ,
13+     " google"  ,
14+     " search"  ,
15+     " blog"  ,
16+     " scrape"  ,
17+     " scraping"  ,
18+     " node"  ,
19+     " nodejs"  ,
20+     " node.js" 
1321  ],
1422  "author" : " Keith Hetrick"  ,
1523  "license" : " ISC"  ,
2028    "pdfkit" : " ^0.13.0"  ,
2129    "unirest" : " ^0.6.0" 
2230  }
23- }
31+ }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments