our $VERSION = '0.002';
our @EXPORT_OK = qw/off/;
+use constant OFF_URL => 'http://offliberty.com/off54.php';
+
use HTML::TreeBuilder;
-use LWP::UserAgent;
+use HTTP::Tiny;
-my $ua = LWP::UserAgent->new;
+my $http = HTTP::Tiny->new(agent => "WWW-Offliberty/$VERSION ");
sub off{
my ($url, @params) = @_;
- my $content = $ua->post("http://offliberty.com/off54.php", {track => $url, @params})->decoded_content;
- my $root = HTML::TreeBuilder->new_from_content($content);
+ my $ret = $http->post_form(OFF_URL, {track => $url, @params});
+ die $ret->{reason} unless $ret->{success};
+ my $root = HTML::TreeBuilder->new_from_content($ret->{content});
map { $_->attr('href') } $root->look_down(qw/_tag a class download/);
}