mirror of
https://github.com/probberechts/soccerdata.git
synced 2026-04-26 02:25:51 +03:00
[PR #907] [MERGED] [Understat] Use new JSON API endpoints #902
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#902
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?
📋 Pull Request Information
Original PR: https://github.com/probberechts/soccerdata/pull/907
Author: @dimitrismoustakas
Created: 12/13/2025
Status: ✅ Merged
Merged: 1/6/2026
Merged by: @probberechts
Base:
master← Head:understat-fix📝 Commits (1)
01f87fcfeat: fixed Understat scraper to work with the new JSON API endpoints📊 Changes
1 file changed (+82 additions, -16 deletions)
View changed files
📝
soccerdata/understat.py(+82 -16)📄 Description
As discussed on Issues #904 and #905, the understat module has stopped working. Understat no longer supports HTML scraping but instead offers API endpoints where you can access the same data as before. I've made the change so that the package uses the endpoints instead. Understat tests pass (they don't pass on the current main branch), but not tests on the other packages. I've tested and these tests failed to begin with so it's not an issue my pull causes but there's an underlying issue with these modules or the tests are not maintained properly.
API Integration and Data Fetching Improvements:
/getStatData,/getLeagueData/{league}/{season},/getMatchData/{match_id}) instead of HTML scraping._request_apihelper method to centralize API requests with appropriate headers, caching, and file storage, improving consistency and reducing code duplication.UNDERSTAT_HEADERSconstant to ensure all API requests include the requiredX-Requested-Withheader.Session and Cookie Management:
_ensure_cookiesto initialize session cookies from the homepage before making API requests, ensuring authenticated and consistent access. [1] [2]🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.