Maybe the US Congress or Library of Congress already have SOAP interfaces to their web sites, but I have not found them, and I spent a couple hours researching a couple of bills yesterday (HR 526: Telemarketing Relief Act and HR2239: Verifiable Vote Something or Other), and what I really wanted was one link that said "Download everything related to this bill" which would include the bill text, status report, co-sponsors (with contact info), related bills, and everything else.
use Congress; # just like big companies!
my $congress = Congress->new;
my $bill = $congress->fetch( 'HR2239' );
print $bill->text;
print "Bill has ", $bill->cosponsors->count, " cosponsors\n";
foreach my $related ( $bill->related ) { print "Related: ", $related->title, "\n"; }
$bill->approve() if int( rand 2 );
Re:indeed
brian_d_foy on 2004-01-07T16:33:43
I wrote to Senator Fitzgerald a while ago, and he invited me to visit him in Washington when I get back (I think he does this for everyone though). Maybe I can bring this up when I talk to him about S1980.:) Re:indeed
inkdroid on 2004-01-07T17:28:38
Cool:-) In the meantime writing a Mech agent, or something that fits into the WWW::Search framework for accessing Thomas may not be too difficult. SOAP would be a whole lot cleaner, and versatile. But... is a nice quick hack...Perl, ahhh!#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $bill = shift;
if ( !$bill ) { print "usage: bill S1980\n"; exit(1); }
my $th = WWW::Mechanize->new();
$th->get( 'http://thomas.loc.gov' );
$th->field( docidc108 => $bill );
$th->submit();
$th->follow_link( text => "GPO's PDF" )
or ( print "No such bill $bill\n" and exit(1) );
$th->follow_link( text => 'Continue' );
open( PDF, ">$bill.pdf" );
print PDF $th->content();
close( PDF );
my $congress = Congress->new;