A web crawler and parser for data on UFC fighters and events
Project description
UFC API
UFC API is a lightweight web crawler built in Python to retrieve data on UFC fighters and events.
Installation
You can install UFC API using pip:
pip install ufc_api
Usage
Usage is simple. To get stats on a particular fighter returned as a json:
>>> from ufc-api import get_fighter
>>> get_fighter('Jon Jones')
>>> {'name': 'Jon Jones',
'nickname': 'Bones',
'nationality': 'United States',
'birthplace': 'Rochester, New York',
'birthdate': 'Jul 19, 1987',
'age': '35',
'height': '6\'4"',
'weight': '248 lbs',
'association': 'Jackson-Wink MMA',
'weight_class': 'Heavyweight',
'wins': {'total': '27',
'ko/tko': '10',
'submissions': '7',
'decisions': '10',
'others': '0'},
'losses': {'total': '1',
'ko/tko': '0',
'submissions': '0',
'decisions': '0',
'others': '1'},
'fights': [{'name': 'UFC 285 - Jones vs. Gane',
'date': 'Mar / 04 / 2023',
'url': 'https://www.sherdog.com/events/UFC-285-Jones-vs-Gane-95232',
'result': 'win',
'method': 'Submission (Guillotine Choke)',
'referee': 'Marc Goddard',
'round': '1',
'time': '2:04',
'opponent': 'Ciryl Gane'},
...
To get data on an event, the usage is similar:
>>> from ufc-api import get_event
>>> get_event('UFC 280')
>>> {'name': 'UFC 280: Oliveira vs. Makhachev',
'date': '2022-10-22',
'location': 'Yas Island/Yas West United Arab Emirates',
'venue': 'Etihad Arena',
'fights': [{'weightclass': 'Lightweight Title',
'red corner': {'name': 'Charles Oliveira',
'ranking': 'Unranked',
'odds': '+165',
'link': 'https://www.ufc.com/athlete/charles-oliveira',
'result': 'Loss'},
'blue corner': {'name': 'Islam Makhachev',
'ranking': 'Unranked',
'odds': '-195',
'link': 'https://www.ufc.com/athlete/islam-makhachev',
'result': 'Win'},
'round': '2',
'time': '3:16',
'method': 'Submission'},
{'weightclass': 'Bantamweight Title',
'red corner': {'name': 'Aljamain Sterling',
'ranking': 'Unranked',
'odds': '-175',
'link': 'https://www.ufc.com/athlete/aljamain-sterling',
'result': 'Win'},
'blue corner': {'name': 'TJ Dillashaw',
'ranking': 'Unranked',
'odds': '+150',
'link': 'https://www.ufc.com/athlete/tj-dillashaw',
'result': 'Loss'},
'round': '2',
'time': '3:44',
'method': 'KO/TKO'},
{'weightclass': 'Bantamweight',
'red corner': {'name': 'Petr Yan',
'ranking': 'Unranked',
'odds': '-275',
'link': 'https://www.ufc.com/athlete/petr-yan',
'result': 'Loss'},
'blue corner': {'name': "Sean O'Malley",
'ranking': 'Unranked',
'odds': '+230',
'link': 'https://www.ufc.com/athlete/sean-omalley',
'result': 'Win'},
'round': '3',
'time': '5:00',
'method': 'Decision - Split'},
...
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
ufc_api-0.0.1.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file ufc_api-0.0.1.tar.gz
.
File metadata
- Download URL: ufc_api-0.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b71d903f63f37c340b8d3adfcc556be426f124a5e9b17e69cb68255e922e6091 |
|
MD5 | b040604be24014b9abb8e4db57bb342b |
|
BLAKE2b-256 | 1515b6f7d1bfeb2fa0d453983088b70094d22e5aaff0a7b4d1ffbb81408a1832 |
File details
Details for the file ufc_api-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: ufc_api-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5dc9b23bba93ee97d9eef76f20b9c885334a5127c6054a59376a82a916e38ba |
|
MD5 | c78774d0c991b167d33252d6d4bd770c |
|
BLAKE2b-256 | 5e5d276a1a3ee0f29b03831b85315a560477a268a4a623a9f0d3bf9455771945 |