-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathdata_download.py
38 lines (24 loc) · 979 Bytes
/
data_download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Downloading script for soccer logs public open dataset:
https://figshare.com/collections/Soccer_match_event_dataset/4415000/2
Data description available here:
Please cite the source as:
"""
import requests, zipfile, json, io
dataset_links = {
'matches' : 'https://ndownloader.figshare.com/files/14464622',
'events' : 'https://ndownloader.figshare.com/files/14464685',
'players' : 'https://ndownloader.figshare.com/files/15073721',
'teams': 'https://ndownloader.figshare.com/files/15073697',
}
r = requests.get(dataset_links['matches'], stream=True)
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall("data/matches")
r = requests.get(dataset_links['events'], stream=True)
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall("data/events")
#
r = requests.get(dataset_links['teams'], stream=False)
print (r.text, file=open('data/teams.json','w'))
r = requests.get(dataset_links['players'], stream=False)
print (r.text, file=open('data/players.json','w'))