Sporks-R-Us:  Bastard Hybrid Utensil of D00M!
Front Page · Everything · News · Op/Ed · Ask A Spork · Interviews · Religion · Reviews · MLP · AK5CG · Strange · Cats · Nonsense · Fiction · Dead at 54 · The Pits of Hell · Meta · Vlad's Store · Diaries · Site News
I got tired of google caches redirecting on me...

books
By Beef
from the Perl-facilitated Evil department, Section Complete and Total Nonsense
Posted on Thu Sep 02, 2004 at 09:11:15 PM GMT
I got very tired of trying to view google-cached documents with cutesy little client-side scripts that would re-direct the browser to the "live" page.  Especially when the cached document contains a very useful forum post that no longer exists, or requires a registration in order to view.  Sooooo... I took about 15 minutes out of my busy day to bang out a perl app that kills all script tags in any document:

dividing image



#!/usr/bin/perl

# descript.pl
# removes all script tags from any url.

use LWP::UserAgent;
use CGI qw(:standard);

my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)");

my $req;
my $res;
my $output;
my $url = param('url');
if ($url) {
  # Create a request
  $req = HTTP::Request->new(GET => $url);
  $req->content_type('text/html');
  # Pass request to the user agent and get a response back
  $res = $ua->request($req);
  $output = $res->content;
  $output =~ s/script/foo/gi;
}

print ("Content-type: text/html\n");
print "Pragma: no-cache", "\n";
print "Expires: Wednesday, 27-Dec-95 05:29:10 GMT", "\n\n";

print "<h2>Page de-scripter 0.1</h2>\n";

print "<form method=\"GET\" action=\"descript.pl\">";
print "Enter a URL: \n";
print "<input size=\"50\" name=\"url\"/>";
print submit("submit", "Descript");
print "</form>";
print "<hr>\n";

print $output;

print "</body></html>";

< Harvest Time | I want a Free Ipod! >
Menu
· create account · faq · search · mission · topics

Login
Make a new account
Username:
Password:

Poll
Is this useful?
Yes.
No.
You are a filthy Communist GNU/hippie.

Votes: 8
Results | Other Polls

Related Links
· google
· windows
· More on books
· Also by Beef

Display: Sort:
I got tired of google caches redirecting on me... | 4 comments (4 topical, 0 hidden)
Stopping Google cache redirects is (5.00 / 2) (#3)
by l33t j03 on Wed Sep 08, 2004 at 03:37:31 PM GMT

stealing.

Reagan thought it all up one night while drinking Bourbon with Satan.



I'm already going to jail anyway... (5.00 / 1) (#4)
by Beef on Thu Sep 09, 2004 at 05:52:30 PM GMT

I get up and make a snack when the commercials come on TV.

--
Be conservative in what you do. Be liberal in what you accept from others.
[ Parent ]



Very interesting (5.00 / 1) (#2)
by BringBackATV on Sat Sep 04, 2004 at 04:47:20 PM GMT

I often take 15 minutes out of my day to bang something out myself...if you know what I mean :)
-- No thanks, I would not like sugar with my cornflakes


Guess I'm lazy. (none / 0) (#1)
by vegetablespork on Thu Sep 02, 2004 at 06:57:14 PM GMT

I always just turn off Javascript--or grab the page with wget. Nice job, though, nonetheless~



I got tired of google caches redirecting on me... | 4 comments (4 topical, 0 hidden)
Display: Sort:

SRU - Embrace the Spork! SourceForge Logo Powered by Scoop
Inspiration
"What is wanted is not the will to believe, but the will to find out, which is the exact opposite."
- Bertrand Russell, "Skeptical_Essays", 1928

Please buy the stuff we sell on ebay.
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 2003-2006 The Management

create account | faq | search