summaryrefslogtreecommitdiff
path: root/dot/local/bin/google
blob: 94ebf0fe3af55920e015bae86b5d7d880247571a (plain)
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl -w
$useragent = 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0';

$_ = join ' ', map { m/ / ? qq<"$_"> : $_ } @ARGV;
s/([^a-zA-Z0-9])/sprintf "%%%x", ord $1/ge;
$url = "https://www.google.com/search?q=$_";

if ($ENV{NO_FAKE_UA}) { exec qw(w3m), "$url" }
else                  { exec qw(w3m -o), "user_agent=$useragent", "$url" }