nkparser is a simple scraping library for netkeiba.com
Project description
nkparser
nkparser is a python library for parsing netkeiba.com data. nkparser only support to parse race (entry), odds, horse and results now.
Please note that this is a heavy load on the netkeiba.com depending on your usage.
Installing nkparser and Supported Versions
nkparser is available on pip installation.
$ python -m pip install nkparser
nkparser officially supports Python 3.8+.
Dependencies
Usage
To load netkeiba.com data and parse to dictionay file.
# import modules
import nkparser
# Load ENTRY
nkdata = nkparser.load("entry", "201206050810")
print(nkdata.info)
# [{'race_id': '201206050810', 'race_number': 10, 'race_name': '有馬記念', ... }]
print(nkdata.table)
# [{'bracket': 7, 'horse_number': 13, 'horse_name': 'ゴールドシップ', ...}, {...}, ...]
# Load ODDS
nkdata = nkparser.load("odds", "201206050810")
print(nkdata.table)
# [{'horse_number': 1, 'tan': 51.6, 'fuku_min': 10.5, 'fuku_max': 18.7, ...}, {...}, ...]
# Load RESULT
nkdata = nkparser.load("result", "201206050810")
print(nkdata.table)
# [{'bracket': 7, 'horse_number': 13, 'horse_name': 'ゴールドシップ', ...}, {...}, ...]
# Load HORSE
nkdata = nkparser.load("horse", "2009102739")
print(nkdata.info)
# [{'horse_id': '2009102739', 'father_name': 'ステイゴールド', ... }]
print(nkdata.table)
# [{'race_date': '20151227', 'race_name': '有馬記念', 'rank': 8, ...}, {...}, ...]
If you execute bulk data load, you can use race_list
function.
# import modules
import nkparser
# bulk load
for race_id in nkparser.race_list(2022, 7):
nkdata = nkparser.load("entry", race_id)
This library generate CREATE TABLE
sql for SQLite3.
# import modules
import nkparser
# generate SQL
sql = nkparser.create_table_sql("entry")
print(sql)
# CREATE TABLE IF NOT EXISTS entry (bracket text, ... weight_diff integer);
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
nkparser-1.4.10.tar.gz
(16.6 kB
view hashes)
Built Distribution
nkparser-1.4.10-py3-none-any.whl
(21.1 kB
view hashes)
Close
Hashes for nkparser-1.4.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5ed0c3b384c6be4ab542dff15644eb8ca1d0ac23e2c91c610142d9b1aa523e0 |
|
MD5 | 8e8b61e44b65259d148ab7f2ad34a90e |
|
BLAKE2b-256 | d6df9cb7513e880054c7e51bdb3e54ef522c4df4148ed0f540e8d339831ad69a |