Class: FtseScraper

Inherits:
StockIndex::BaseScraper show all
Defined in:
lib/stock_index/scrapers/ftse_scraper.rb

Instance Method Summary collapse

Methods inherited from StockIndex::BaseScraper

#build_wikipedia_link, #td, #wikipedia_position

Instance Method Details

#scrapeObject



3
4
5
6
7
8
9
10
# File 'lib/stock_index/scrapers/ftse_scraper.rb', line 3

def scrape
  @wikipedia_hash = parse_wikipedia_page(Nokogiri::HTML(open(StockIndex::INDICES['^FTSE'][:wikipedia_url])))
  (1..6).inject([]) do |array, page|
    doc = Nokogiri::HTML(open(url(page)))
    array += parse_rows(doc.css('table.table_dati tr'))
    array
  end
end