Skip to content

Commit

Permalink
Update scraper.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
anazamarron committed Apr 15, 2015
1 parent 467e277 commit 1bb2494
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions scraper.rb
Expand Up @@ -2,18 +2,23 @@
# including some code snippets below that you should find helpful

# require 'scraperwiki'
# require 'mechanize'
#
# agent = Mechanize.new
require 'mechanize'

# Creamos un mechanize
agent = Mechanize.new
#
# # Read in a page
# page = agent.get("http://foo.com")
page = agent.get("http://www.congreso.es/portal/page/portal/Congreso/Congreso/Diputados?_piref73_1333056_73_1333049_1333049.next_page=/wc/menuAbecedarioInicio&tipoBusqueda=completo&idLegislatura=10")

page.links.each do |link|
puts link.text
end
#
# # Find somehing on the page using css selectors
# p page.at('div.content')
#p page.at('div.listado1')
#
# # Write out to the sqlite database using scraperwiki library
ScraperWiki.save_sqlite(["name"], {"name" => "Perry", "occupation" => "software developer"})
# ScraperWiki.save_sqlite(["name"], {"name" => "Perry", "occupation" => "software developer"})
#
# # An arbitrary query against the database
# ScraperWiki.select("* from data where 'name'='peter'")
Expand All @@ -22,4 +27,6 @@
# on Morph for Ruby (https://github.com/openaustralia/morph-docker-ruby/blob/master/Gemfile) and all that matters
# is that your final data is written to an Sqlite database called data.sqlite in the current working directory which
# has at least a table called data.
puts 'Hola Mundo'



0 comments on commit 1bb2494

Please sign in to comment.