sofascrape


Namesofascrape JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA Python library for scraping and interacting with SofaScore APIs
upload_time2025-10-07 16:40:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License
keywords sofascore scraping sports football api
VCS
bugtrack_url
requirements playwright beautifulsoup4 requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sofascrape

A Python library for scraping and interacting with SofaScore APIs to access football statistics, events, and other sports data.

## Installation

```bash
pip install sofascrape
```

## Features

- Easy access to SofaScore API endpoints
- Built-in data formatting and export capabilities (JSON, CSV)
- Context manager support for resource management
- Comprehensive coverage of SofaScore API endpoints

## Usage

### Basic Usage

```python
from sofascrape import SofascrapeClient

# Use context manager for automatic resource management
with SofascrapeClient() as client:
    # Get football categories
    categories = client.get_sport_categories()
    print(categories.data)  # Access raw data
    
    # Save as JSON file
    categories.json("football_categories.json")
    
    # Save as CSV file
    categories.csv("football_categories.csv")
```

### Advanced Usage

```python
from sofascrape import SofascrapeClient

# Initialize client with custom options
client = SofascrapeClient(headless=True, timeout=60000)

try:
    client.start()  # Manually start the client
    
    # Get live football events
    live_events = client.get_live_events()
    
    # Access data directly
    for event in live_events:
        print(event)
    
    # Get specific tournament standings
    standings = client.get_tournament_standings(tournament_id=123, season_id=456)
    standings.json("standings.json")
    
finally:
    client.close()  # Manually close the client
```

## Available Methods

The library provides access to various SofaScore API endpoints:

- `get_sport_categories()` - Get all available football categories
- `get_live_events()` - Get all live football events
- `get_event_data(event_id)` - Get core data for a specific event
- `get_event_lineups(event_id)` - Get lineups for a specific event
- `get_tournament_standings(tournament_id, season_id)` - Get standings for a tournament
- `get_team_info(team_id)` - Get information about a specific team
- And many more endpoints...

For a complete list of available methods, check the client.py file.

## Response Objects

API responses are wrapped in `ApiResponse` objects that provide:

- Direct access to data via `.data`
- JSON export via `.json([filename])`
- CSV export via `.csv([filename])`
- Dictionary-like access via `[]`
- Iteration support via `iter()`
- Length via `len()`

## License

MIT License. See the [LICENSE](LICENSE) file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sofascrape",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "sofascore, scraping, sports, football, api",
    "author": null,
    "author_email": "Chumari <dchumari@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ca/6f/97b6bd2bad37ed0d6358b8add3270aae65916e0810067e018fca372e468a/sofascrape-0.1.2.tar.gz",
    "platform": null,
    "description": "# Sofascrape\r\n\r\nA Python library for scraping and interacting with SofaScore APIs to access football statistics, events, and other sports data.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install sofascrape\r\n```\r\n\r\n## Features\r\n\r\n- Easy access to SofaScore API endpoints\r\n- Built-in data formatting and export capabilities (JSON, CSV)\r\n- Context manager support for resource management\r\n- Comprehensive coverage of SofaScore API endpoints\r\n\r\n## Usage\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom sofascrape import SofascrapeClient\r\n\r\n# Use context manager for automatic resource management\r\nwith SofascrapeClient() as client:\r\n    # Get football categories\r\n    categories = client.get_sport_categories()\r\n    print(categories.data)  # Access raw data\r\n    \r\n    # Save as JSON file\r\n    categories.json(\"football_categories.json\")\r\n    \r\n    # Save as CSV file\r\n    categories.csv(\"football_categories.csv\")\r\n```\r\n\r\n### Advanced Usage\r\n\r\n```python\r\nfrom sofascrape import SofascrapeClient\r\n\r\n# Initialize client with custom options\r\nclient = SofascrapeClient(headless=True, timeout=60000)\r\n\r\ntry:\r\n    client.start()  # Manually start the client\r\n    \r\n    # Get live football events\r\n    live_events = client.get_live_events()\r\n    \r\n    # Access data directly\r\n    for event in live_events:\r\n        print(event)\r\n    \r\n    # Get specific tournament standings\r\n    standings = client.get_tournament_standings(tournament_id=123, season_id=456)\r\n    standings.json(\"standings.json\")\r\n    \r\nfinally:\r\n    client.close()  # Manually close the client\r\n```\r\n\r\n## Available Methods\r\n\r\nThe library provides access to various SofaScore API endpoints:\r\n\r\n- `get_sport_categories()` - Get all available football categories\r\n- `get_live_events()` - Get all live football events\r\n- `get_event_data(event_id)` - Get core data for a specific event\r\n- `get_event_lineups(event_id)` - Get lineups for a specific event\r\n- `get_tournament_standings(tournament_id, season_id)` - Get standings for a tournament\r\n- `get_team_info(team_id)` - Get information about a specific team\r\n- And many more endpoints...\r\n\r\nFor a complete list of available methods, check the client.py file.\r\n\r\n## Response Objects\r\n\r\nAPI responses are wrapped in `ApiResponse` objects that provide:\r\n\r\n- Direct access to data via `.data`\r\n- JSON export via `.json([filename])`\r\n- CSV export via `.csv([filename])`\r\n- Dictionary-like access via `[]`\r\n- Iteration support via `iter()`\r\n- Length via `len()`\r\n\r\n## License\r\n\r\nMIT License. See the [LICENSE](LICENSE) file for more details.\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A Python library for scraping and interacting with SofaScore APIs",
    "version": "0.1.2",
    "project_urls": {
        "Bug Reports": "https://github.com/dchumari/sofascrape/issues",
        "Homepage": "https://github.com/dchumari/sofascrape",
        "Repository": "https://github.com/dchumari/sofascrape.git"
    },
    "split_keywords": [
        "sofascore",
        " scraping",
        " sports",
        " football",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5fa41dc025101922d6b1b1ea0ab4ced1c908e8ff4690d5337196bbbe5845a708",
                "md5": "4501a16b101421b1f1127a85de9d9e03",
                "sha256": "85a7383556563a6475e396282e675d104af8faf0082f30f25978cbd8f067661d"
            },
            "downloads": -1,
            "filename": "sofascrape-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4501a16b101421b1f1127a85de9d9e03",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8483,
            "upload_time": "2025-10-07T16:40:11",
            "upload_time_iso_8601": "2025-10-07T16:40:11.749284Z",
            "url": "https://files.pythonhosted.org/packages/5f/a4/1dc025101922d6b1b1ea0ab4ced1c908e8ff4690d5337196bbbe5845a708/sofascrape-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ca6f97b6bd2bad37ed0d6358b8add3270aae65916e0810067e018fca372e468a",
                "md5": "069d9a8d986dc1e7671783c48b6d6bc3",
                "sha256": "35309bf6bf3d4a8ce4472959d96880c6e85c00270d6b20d67e5a3f3f1206652b"
            },
            "downloads": -1,
            "filename": "sofascrape-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "069d9a8d986dc1e7671783c48b6d6bc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8942,
            "upload_time": "2025-10-07T16:40:12",
            "upload_time_iso_8601": "2025-10-07T16:40:12.807680Z",
            "url": "https://files.pythonhosted.org/packages/ca/6f/97b6bd2bad37ed0d6358b8add3270aae65916e0810067e018fca372e468a/sofascrape-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 16:40:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dchumari",
    "github_project": "sofascrape",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "playwright",
            "specs": [
                [
                    ">=",
                    "1.30.0"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    ">=",
                    "4.11.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.28.0"
                ]
            ]
        }
    ],
    "lcname": "sofascrape"
}
        
Elapsed time: 2.65243s