I have an rails application wherein i am scraping data from the internet. I have this snippet of code where it reports syntax errors thus preventing it from running.
I have tried to sort it out but unable to find out what is wrong. Where am i going wrong.
The snippet is shown below:
def reuters
ticker_sym = 'FB.O'
reuters_home_url = "http://in.reuters.com"
reuters_base_url = "http://in.reuters.com/finance/stocks/"
board_members = Nokogiri::HTML(open(reuters_base_url + 'companyOfficers?symbol=' + ticker_sym.to_s ))
members = []
table = board_members.css('.column1 tbody.dataSmall').first
table_desc = board_members.css('.column1 tbody.dataSmall')[1]
table.css('tr').each_with_index do |row,index|
next if index == 0
members << {
name: row.css('td[1] h2 a').text.strip,
title: row.css('td[4]').text.strip,
position_held: row.css('td[3]').text.strip,
age: row.css('td[2]').text.strip,
member_link: URI.join(reuters_home_url,row.css('td[1] h2 a').attr("href")).to_s
table_desc.css('tr').each_with_index do |col,index2|
next if index2 == 0
members << {
description: col.css('td[2]').text.strip
}
end
}
end
end
Have attached a screenshot of my rails application error page shown below: