probberechts / soccerdata

⛏⚽ Scrape soccer data from Club Elo, ESPN, FBref, FiveThirtyEight, Football-Data.co.uk, FotMob, Sofascore, SoFIFA, Understat and WhoScored.
https://soccerdata.readthedocs.io/en/latest/
Other
511 stars 87 forks source link

[WhoScored] javascript error: requirejs is not defined #617

Closed WillT23 closed 3 days ago

WillT23 commented 5 days ago

Hi, hopefully you are able to help (and thanks again for this fantastic package!).

Was able to use this earlier this week no problem, but encountering an error today like below when trying to scrape any game from any league (custom or default). I've updated the soccerdata package, and updated other packages but the error remains. Am I missing something simple?

Thanks, Will

[06/26/24 20:49:26] ERROR    Error while scraping https://www.whoscored.com/Matches/1729417/Live.    [_common.py](file:///C:/Users/will-/anaconda3/lib/site-packages/soccerdata/_common.py):[655](file:///C:/Users/will-/anaconda3/lib/site-packages/soccerdata/_common.py#655)
                             Retrying in 0 seconds... (attempt 1 of 5).                                            
                             Traceback (most recent call last):                                                    
                               File                                                                                
                             "C:\Users\will-\anaconda3\lib\site-packages\soccerdata\_common.py",                   
                             line 646, in _download_and_save                                                       
                                 response = json.dumps(self._driver.execute_script("return " +                     
                             var)).encode(                                                                         
                               File                                                                                
                             "C:\Users\will-\anaconda3\lib\site-packages\selenium\webdriver\remote\w               
                             ebdriver.py", line 414, in execute_script                                             
                                 return self.execute(command, {"script": script, "args":                           
                             converted_args})["value"]                                                             
                               File                                                                                
                             "C:\Users\will-\anaconda3\lib\site-packages\selenium\webdriver\remote\w               
                             ebdriver.py", line 354, in execute                                                    
                                 self.error_handler.check_response(response)                                       
                               File                                                                                
                             "C:\Users\will-\anaconda3\lib\site-packages\selenium\webdriver\remote\e               
                             rrorhandler.py", line 229, in check_response                                          
                                 raise exception_class(message, screen, stacktrace)                                
                             selenium.common.exceptions.JavascriptException: Message: javascript                   
                             error: requirejs is not defined                                                       
                               (Session info: chrome=126.0.6478.116)                                               
                             Stacktrace:                                                                           
                                     GetHandleVerifier [0x011DC1C3+27395]                                          
                                     (No symbol) [0x01173DC4]                                                      
                                     (No symbol) [0x01071B7F]                                                      
                                     (No symbol) [0x01076C7F]                                                      
                                     (No symbol) [0x01078B7F]                                                      
                                     (No symbol) [0x010ED51B]                                                      
                                     (No symbol) [0x010D399C]                                                      
                                     (No symbol) [0x010ECB24]                                                      
                                     (No symbol) [0x010D3736]                                                      
                                     (No symbol) [0x010A7541]                                                      
                                     (No symbol) [0x010A80BD]                                                      
                                     GetHandleVerifier [0x01493A93+2876371]                                        
                                     GetHandleVerifier [0x014E7F5D+3221661]                                        
                                     GetHandleVerifier [0x0125D634+556916]                                         
                                     GetHandleVerifier [0x0126474C+585868]                                         
                                     (No symbol) [0x0117CE04]                                                      
                                     (No symbol) [0x01179818]                                                      
                                     (No symbol) [0x011799B7]                                                      
                                     (No symbol) [0x0116BF0E]                                                      
                                     BaseThreadInitThunk [0x76AF7BA9+25]                                           
                                     RtlInitializeExceptionChain [0x77EAC10B+107]                                  
                                     RtlClearBits [0x77EAC08F+191]
WillT23 commented 4 days ago

Your changes seemed to have worked - thank you so much. Do you have somewhere for donations or perhaps a charity I could donate to on your behalf by way of thanks?

adlihs commented 3 days ago

Your changes seemed to have worked - thank you so much. Do you have somewhere for donations or perhaps a charity I could donate to on your behalf by way of thanks?

Mate how do you fix the issue?

WillT23 commented 3 days ago

Your changes seemed to have worked - thank you so much. Do you have somewhere for donations or perhaps a charity I could donate to on your behalf by way of thanks?

Mate how do you fix the issue?

In the fix above my comment he's made some changes to the whoscored file - I just inputted those changes into my file within the soccerdata library folder.

probberechts commented 3 days ago

Or now simply pip install soccerdata==1.8.1.