The Code
Note that this script just does a couple of date translations in Perl
and redirects the browser to Google, altered query in tow.
It's just a regular query as far as Google is
concerned, so it doesn't require a
developer's API key.
TIP
This hack requires an additional module,
Time::JulianDay, and won't run
without it (http://search.cpan.org/search?query=Time%3A%3AJulianDay).
#!/usr/local/bin/perl
# goofresh.cgi
# Searches for recently indexed files on Google.
# Usage: goofresh.cgi is called as a CGI with form input,
# redirecting the browser to Google, altered query in tow.
use CGI qw/:standard/;
use Time::JulianDay;
# Build a URL-escaped query.
(my $query = param('query')) =~ s#(\W)#sprintf("%%%02x", ord($1))#ge;
# How many days back?
my $days_back = int param('days_back') || 0;
# What's the current Julian date?
my $julian_date = int local_julian_day(time);
# Redirect the browser to Google with query in tow.
print redirect(
'http://www.google.com/search?num=100' .
"&q=$query" .
"+daterange%3A" . ($julian_date - $days_back) . "-$julian_date"
);