[GH-ISSUE #628] [WhoScored] requirejs is not defined #121

Closed
opened 2026-03-02 15:55:58 +03:00 by kerem · 1 comment
Owner

Originally created by @chrisdebo on GitHub (Jul 4, 2024).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/628

Hi, Scraping works fine for me except for EURO 2024.
It worked last time I tried it on 21th of June.

The same code still works for other leagues.

I updated chrome, chromedriver, soccerdata and all dependencies.

My Code:
`import soccerdata as sd

league = 'INT-European Championship'
season = '2024'

whoscored = sd.WhoScored(leagues=[league], seasons=season)
df = whoscored.read_schedule()

def process_row(row):
match_id = row['game_id']
try:
print(f"processing match: {match_id}")
whoscored.read_events(match_id=match_id, force_cache=True, output_fmt='events')
except Exception as e:
print(f"error while processing match: {match_id}")
print(f"errordetails: {e}")

df.apply(process_row, axis=1)`

I always get this error:

[07/04/24 09:36:53] ERROR Error while scraping _common.py:655
https://www.whoscored.com/Matches/18
26802/Live. Retrying in 30
seconds... (attempt 4 of 5).
Traceback (most recent call last):
File
"/Users/chris/anaconda3/envs/whosco
red-scraping/lib/python3.11/site-pac
kages/soccerdata/_common.py", line
646, in _download_and_save
response =
json.dumps(self._driver.execute_scri
pt("return " + var)).encode(
^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/chris/anaconda3/envs/whosco
red-scraping/lib/python3.11/site-pac
kages/selenium/webdriver/remote/webd
river.py", line 414, in
execute_script
return self.execute(command,
{"script": script, "args":
converted_args})["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^
File
"/Users/chris/anaconda3/envs/whosco
red-scraping/lib/python3.11/site-pac
kages/selenium/webdriver/remote/webd
river.py", line 354, in execute
self.error_handler.check_respons
e(response)
File
"/Users/chris/anaconda3/envs/whosco
red-scraping/lib/python3.11/site-pac
kages/selenium/webdriver/remote/erro
rhandler.py", line 229, in
check_response
raise exception_class(message,
screen, stacktrace)
selenium.common.exceptions.Javascrip
tException: Message: javascript
error: requirejs is not defined

and

Traceback (most recent call last):
File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 2, in
whoscored.read_events(match_id=match_id, output_fmt='events')
File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/whoscored.py", line 703, in read_events
reader = self.get(
^^^^^^^^^
File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/_common.py", line 306, in get
return self._download_and_save(url, filepath, var)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/_common.py", line 665, in _download_and_save
raise ConnectionError(f"Could not download {url}.")
ConnectionError: Could not download https://www.whoscored.com/Matches/1826802/Live.

Originally created by @chrisdebo on GitHub (Jul 4, 2024). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/628 Hi, Scraping works fine for me except for EURO 2024. It worked last time I tried it on 21th of June. The same code still works for other leagues. I updated chrome, chromedriver, soccerdata and all dependencies. My Code: `import soccerdata as sd league = 'INT-European Championship' season = '2024' whoscored = sd.WhoScored(leagues=[league], seasons=season) df = whoscored.read_schedule() def process_row(row): match_id = row['game_id'] try: print(f"processing match: {match_id}") whoscored.read_events(match_id=match_id, force_cache=True, output_fmt='events') except Exception as e: print(f"error while processing match: {match_id}") print(f"errordetails: {e}") df.apply(process_row, axis=1)` I always get this error: [07/04/24 09:36:53] ERROR Error while scraping _common.py:655 https://www.whoscored.com/Matches/18 26802/Live. Retrying in 30 seconds... (attempt 4 of 5). Traceback (most recent call last): File "/Users/chris/anaconda3/envs/whosco red-scraping/lib/python3.11/site-pac kages/soccerdata/_common.py", line 646, in _download_and_save response = json.dumps(self._driver.execute_scri pt("return " + var)).encode( ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chris/anaconda3/envs/whosco red-scraping/lib/python3.11/site-pac kages/selenium/webdriver/remote/webd river.py", line 414, in execute_script return self.execute(command, {"script": script, "args": converted_args})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ File "/Users/chris/anaconda3/envs/whosco red-scraping/lib/python3.11/site-pac kages/selenium/webdriver/remote/webd river.py", line 354, in execute self.error_handler.check_respons e(response) File "/Users/chris/anaconda3/envs/whosco red-scraping/lib/python3.11/site-pac kages/selenium/webdriver/remote/erro rhandler.py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.Javascrip tException: Message: javascript error: requirejs is not defined and Traceback (most recent call last): File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-91f9e084ecee>", line 2, in <module> whoscored.read_events(match_id=match_id, output_fmt='events') File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/whoscored.py", line 703, in read_events reader = self.get( ^^^^^^^^^ File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/_common.py", line 306, in get return self._download_and_save(url, filepath, var) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/chris/anaconda3/envs/whoscored-scraping/lib/python3.11/site-packages/soccerdata/_common.py", line 665, in _download_and_save raise ConnectionError(f"Could not download {url}.") ConnectionError: Could not download https://www.whoscored.com/Matches/1826802/Live.
kerem 2026-03-02 15:55:58 +03:00
Author
Owner

@probberechts commented on GitHub (Jul 4, 2024):

Duplicate of #617. Updating should fix this.

<!-- gh-comment-id:2208483811 --> @probberechts commented on GitHub (Jul 4, 2024): Duplicate of #617. Updating should fix this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#121
No description provided.