Searching for Special Characters
Search for the tilde and other special characters in URLs.
Google can find lots of different things, but at this writing, it
can’t find special characters in its search results.
That’s a shame, because special characters can come
in handy. The tilde (
~), for example, denotes
personal web pages.
This hack takes a query from a form, pulls results from Google, and filters the results for the presence of several different special characters in the URL, including the tilde.
Why would you want to do this? By altering this hack slightly (see
Hacking the Hack) you could restrict
your searches to just pages with a tilde in the URL, an easy way to
find personal pages. Maybe you’re looking for
dynamically generated pages with a question mark
?) in the URL; you can’t find
these using Google by itself, but you can thanks to this hack. And of
course you can turn the hack inside out and not return results
containing ~, ?, or other special characters. In fact, this code is
more of a beginning than an end unto itself; you can tweak it in
several different ways to do several different things.
#!/usr/local/bin/perl # aunt_tilde.pl # Finding special characters in Google result URLs # Your Google API developer's key my $google_key='insert key here'; # Number of times to loop, retrieving 10 results at a time my $loops = 10; # Location of the GoogleSearch WSDL file my $google_wdsl = "./GoogleSearch.wsdl"; use strict; use CGI qw/:standard/; use SOAP::Lite; print ...