mirror of
https://github.com/probberechts/soccerdata.git
synced 2026-04-25 10:05:53 +03:00
[GH-ISSUE #628] [WhoScored] requirejs is not defined #121
Labels
No labels
ESPN
FBref
FotMob
MatchHistory
SoFIFA
Sofascore
WhoScored
WhoScored
bug
build
common
dependencies
discussion
documentation
duplicate
enhancement
good first issue
invalid
performance
pull-request
question
question
removal
understat
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/soccerdata#121
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@probberechts commented on GitHub (Jul 4, 2024):
Duplicate of #617. Updating should fix this.