9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/bike_reg/scraper.rb', line 9
def parse(response, url: '', data: {})
riders = []
trs = response.css('tr.event-participant')
trs.each do |tr|
state = tr.css('.state').text
last_name = tr.css('.lastname').text
name = "#{tr.css('#tdFirstName').text} #{last_name}"
team = tr.css('.team div').text.gsub("\r", '').gsub("\n", '').strip
riders << { name: name, team: team, state: state }
end
OpenStruct
.new(
body: {
riders: riders,
ResultCount: riders.count
}.with_indifferent_access
)
end
|