-
Notifications
You must be signed in to change notification settings - Fork 14
/
__init__.py
33 lines (24 loc) · 962 Bytes
/
__init__.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
from ..utils import Scraper
from .utsg import UTSGAthletics
from .utm import UTMAthletics
from .utsc import UTSCAthletics
from collections import OrderedDict
class Athletics:
@staticmethod
def scrape(location='.', month=None):
Scraper.logger.info('Athletics initialized.')
docs = OrderedDict()
for campus in UTSGAthletics, UTMAthletics, UTSCAthletics:
athletics = campus.scrape(location, month=month, save=False)
if athletics is None:
continue
for date, data in athletics.items():
if date not in docs:
docs[date] = OrderedDict([
('date', date),
('events', [])
])
docs[date]['events'].extend(data['events'])
for date, doc in docs.items():
Scraper.save_json(doc, location, date)
Scraper.logger.info('Athletics completed.')