Skip to content

Instantly share code, notes, and snippets.

@ischurov
Created May 4, 2019 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischurov/ac89ddf6f4209cb2902141866a25f28a to your computer and use it in GitHub Desktop.
Save ischurov/ac89ddf6f4209cb2902141866a25f28a to your computer and use it in GitHub Desktop.
perl-fetcher
#!/usr/bin/env perl
use warnings;
use LWP::Simple;
use utf8;
use strict;
use LWP::UserAgent ();
my $s;
my $response;
# Start your script below this line;
open(URL, '<url.list.txt') or die $!;
open(RAW, '>>raw.pages.txt') or die $!;
my $ua = LWP::UserAgent->new;
while (<URL>){
print $_;
$response = $ua->get($_);;
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
print "----\n";
#print RAW "NEWITEM\t", get($_);
}
close RAW;
close URL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment