Displaying 2 results from an estimated 2 matches for "scrape_data".
2009 Jun 06
5
Rake Tasks
...ame, childsearch)
@url = url
@element_type = element_type
@clsname = clsname
@childsearch = childsearch
@doc = Hpricot(open(url))
@numrows = numrows
end
# Scrape data based on the type of element, its class name, and define
the child element that contains our data
def scrape_data
@rows = []
(doc/"#{@element_type}.#{@clsname}#{@childsearch}").each do |row|
cells = []
(row/"td").each do |cell|
if (cell/" span.s").length > 0
values = (cell/"span.s").inner_html.split(''<br
/&g...
2009 Jun 07
17
ActiveRecord Classes
...ta to our
db"
task :scraper => :environment do
offensive_rushing =
Scraper.new(''http://web1.ncaa.org/mfb/natlRank.jsp?year=2008&rpt=IA_teamrush&site=org'',
''table'', ''statstable'', ''//tr'')
offensive_rushing.scrape_data
offensive_rushing.clean_celldata
offensive_rushing.print_values
offensive_rushing.update_rushing_offense # the call to the method
above
end
Now if I run the rake file what is going to happen is I''m going to get
an error stating:
Table ''project_development.scrapers''...