Skip to content

Instantly share code, notes, and snippets.

@paulogeyer
Created October 13, 2010 23:03
Show Gist options
  • Save paulogeyer/625139 to your computer and use it in GitHub Desktop.
Save paulogeyer/625139 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
(1..948067).each do |n|
url = "http://www.portaltransparencia.gov.br/PortalTransparenciaPesquisaFavorecidoPF.asp?Exercicio=2010&Pagina=#{n}"
doc = Nokogiri::HTML(open(url))
doc.xpath('//div[@id="listagem"]/table//tr').each do |c|
puts "-"
puts "cpf: #{c.children[0].content}"
puts "nome: #{c.children[2].content}"
puts "valor: R$#{c.children[4].content}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment