Python API wrapper for SofaScore
Project description
Sofascore Wrapper
A Python API wrapper for the Sofascore undocumented API. This library allows you to fetch and interact with Sofascore data, including information about matches, players, teams, and more.
📖 Documentation
For detailed usage and API reference, visit the official documentation: 👉 Sofascore Wrapper Docs
📥 Installation
1. Install the Package and Playwright
pip install sofascore-wrapper
# REQUIRED FOR USE
python -m playwright install chromium
🚀 Usage Example
Here's a quick example to get you started:
import asyncio
import json
from sofascore_wrapper.api import SofascoreAPI
from sofascore_wrapper.search import Search
async def main():
api = SofascoreAPI() # Initialize the API client
search = Search(api, search_string="saka")
player = await search.search_all()
print(json.dumps(player, indent = 4))
await api.close()
if __name__ == "__main__":
asyncio.run(main())
Example Response!
{
"results": [
{
"entity": {
"id": 934235,
"name": "Bukayo Saka",
"slug": "bukayo-saka",
"retired": false,
"userCount": 205496,
"team": {
"id": 42,
"name": "Arsenal",
"nameCode": "ARS",
"slug": "arsenal",
"national": false,
"sport": {
"id": 1,
"slug": "football",
"name": "Football"
},
"userCount": 2540585,
"teamColors": {
"primary": "#cc0000",
"secondary": "#ffffff",
"text": "#ffffff"
},
"gender": "M",
"fieldTranslations": {
"nameTranslation": {
"ar": "\u0627\u0631\u0633\u0646\u0627\u0644",
"ru": "\u0410\u0440\u0441\u0435\u043d\u0430\u043b",
"hi": "\u0906\u0930\u094d\u0938\u0947\u0928\u0932",
"bn": "\u0986\u09b0\u09cd\u09b8\u09c7\u09a8\u09be\u09b2"
},
"shortNameTranslation": {}
}
},
"deceased": false,
"country": {
"alpha2": "EN",
"name": "England",
"slug": "england"
},
"shortName": "B. Saka",
"position": "F",
"jerseyNumber": "7",
"fieldTranslations": {
"nameTranslation": {
"ar": "\u0628. \u0633\u0627\u0643\u0627",
"hi": "\u092c\u0940. \u0938\u093e\u0915\u093e",
"bn": "\u09ac\u09bf. \u09b8\u09be\u0995\u09be"
},
"shortNameTranslation": {}
}
},
"score": 651868.6,
"type": "player"
},
...
💬 Need Help?
Join our Discord community for support and discussions: 👉 Discord Support Server
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
From Me!
Will slowly be adding more sports along our journey! SofaScore API is written to re-use requests for multiple sports, So in theory making requests for a sport other than football (soccer) will allow you to make requests with any class (match, player, etc). Any requests for the dedicated sport that you cannot, they will be under the dedicated sport i.e Basketball.player_stats() rather than Player.stats()
- If you encounter any issues feel free to open an issue.
- If you have any enhancement requests, feel free to open an issue with the front end proof of what you're looking to get.
- Always open to pull requests!
This is an unofficial API wrapper and not affiliated with Sofascore. You may be at risk via Sofascore's TOS.
RECENTLY CHANGED TO CHROMIUM BASED REQUESTS TO ADVERT 403 ON ALL REST REQUESTS
Examples
Check out some more use cases from the examples folder!
Enjoy using Sofascore Wrapper! 🎉
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sofascore_wrapper-1.1.1.tar.gz.
File metadata
- Download URL: sofascore_wrapper-1.1.1.tar.gz
- Upload date:
- Size: 59.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ccf5b90d8fd260da73fe4909bed06fe7124b7aa10a6d22e7b611a693719ef5e
|
|
| MD5 |
5a117b1ae455ebe9b158c61e96d840ab
|
|
| BLAKE2b-256 |
eebd3873e6a7e1955c21032503004f1927315136438ba1014cd1bde1554c8979
|
File details
Details for the file sofascore_wrapper-1.1.1-py3-none-any.whl.
File metadata
- Download URL: sofascore_wrapper-1.1.1-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20bcb5d7381ff466a92e3b8dd1ae666ebc4aab3950cf807649886c9c7c1ca9c0
|
|
| MD5 |
f2d2f2cc22e6402ce6a97413312a30fe
|
|
| BLAKE2b-256 |
596a9de2f3d1bf2fc5c5988db5f4843ed6d3c1122d51f3e42a760bc8cf8c91b2
|