Created
May 4, 2019 09:47
-
-
Save ischurov/ac89ddf6f4209cb2902141866a25f28a to your computer and use it in GitHub Desktop.
perl-fetcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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