in reply to
Network Outlet
I encountered problems with
URI::Escape, so I reworked your script to make it a little
simpler. I used
LWP::UserAgent instead of
LWP::Simple and used ":content_file => " to make a file.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use URI::Escape;
print "Enter an URL and Press Enter: \n";
my $url = <ARGV>;
my $ua = LWP::UserAgent->new;
my $response = $ua->get(
$url,
':content_file' => '/root/Desktop/url.log',
);
die "Couldn't get $url" unless defined $response;
if ($response->is_success) {
print $response->decoded_content;
}
else {
die $response->status_line;
}
my $videoURL = uri_escape_utf8($url);
my $new_videoURL = uri_unescape($videoURL);
print $new_videoURL ;
This is only a skeleton, but I think that you could usefully
build upon it.
Updated: Revised. Thanks to jwkrahn for catching the mistake.