Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
kashav committed Apr 28, 2016
1 parent 97691b4 commit fde30b6
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions uoftscrapers/scrapers/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def scrape(location='.'):
Scraper.ensure_location(location)

for event in Events.get_events_list():
doc = Events.get_event_doc(event['link'], event['date'])
doc = Events.get_event_doc(event[0], event[1])
Scraper.save_json(doc, location, doc['id'])

Scraper.logger.info('Events completed.')
Expand All @@ -46,13 +46,7 @@ def get_events_list():
events_links += list(map(lambda e: e.a['href'], events_dom_arr))
events_dates += list(map(lambda e: e.find('p').text.split(' : ')[1].split(', ')[0], events_dom_arr))

events_info = []
for i in range(len(events_links)):
events_info.append({
'link': events_links[i],
'date': events_dates[i]
})
return events_info
return zip(events_links, events_dates)

@staticmethod
def convert_time(time_str):
Expand Down Expand Up @@ -110,10 +104,11 @@ def get_event_doc(url_tail, event_date):
# year not in start date
start_date = '%s %s' % (start_date, end_date.split(' ')[2])

event_start_date = datetime.strptime(start_date,
'%b %d %Y').date().isoformat()
event_end_date = datetime.strptime(end_date,
'%b %d %Y').date().isoformat()
start_date = datetime.strptime(start_date, '%b %d %Y')
end_date = datetime.strptime(end_date, '%b %d %Y')

event_start_date = start_date.date().isoformat()
event_end_date = end_date.date().isoformat()

raw_time = soup.select('.date')[0].text.split(',')

Expand Down

0 comments on commit fde30b6

Please sign in to comment.