public
Created

  • Download Gist
poor-mans-fech.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/usr/bin/env ruby
 
require 'rubygems'
require 'open-uri'
 
committee_id = ARGV.shift
search = ARGV.join(" ")
 
if committee_id.nil? || search.nil?
puts <<-USAGE
Poor man's fec searchin'
 
poor-fec <committee_id> <search string>
USAGE
end
 
URL = "http://query.nictusa.com/cgi-bin/dcdev/forms/#{committee_id}"
 
ids = open(URL).read.scan(/HREF='(.*)\/'/).map(&:shift)
 
ids.each do |id|
data = open("http://query.nictusa.com/dcdev/posted/#{id}.fec").read
data.split("\n").each do |row|
puts row if row =~ /#{search}/i
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.