Subject: Google pagerank hack

From: "Nadav Har'El" <[email-masked]>
Date: Mon, 6 Sep 2004 15:33:22 +0300

Ever wanted to know the Google pagerank of your own site (or some other
site)? Well, you could use Google's "Google Bar" but that only works in
Windows and Internet Explorer...

Today I noticed a site, http://my.rank.online.fr/, which lets you find
your own site's pagerank. They ask you to put an image of theirs (and a
link to them) on your site, and the pagerank will appear in that image
(and their own page rank will increase in the process :)).

But that's not fun, and doesn't let you find pagerank of other sites. So
why not do some "web automation" and turn this pagerank-finding site into
a script? (those who heard my "web automation" presentation already know
my way of thinking :) )

So here's a tiny 2 line script that does it:

	curl -e $1 -i http://my.rank.online.fr/pagerank.php 2>/dev/null |
	grep "^Location: " | sed -n 's/^Location: pr\(.*\).gif/\1/; p'

For example, I wanted to check the pagerank of some of my own sites:

$ pagerank http://www.iguide.co.il/
7
$ pagerank http://nadav.harel.org.il/
6
$ pagerank http://ivrix.org.il/projects/spell-checker/
6

Or the page rank of some famous sites:

$ pagerank http://wikipedia.org/    
8
$ pagerank http://ibm.com      
9
$ pagerank http://msn.com/      
10

Or, for a more exciting exercise, let's check which of the Technion departments
rules! (as judged by Google).
I was not very surprised to see which department won :) 

Pagerank | Department homepages with this pagerank
         | (took homepage variant with highest pagerank)
--------------------------------------------------
8        | Technion homepage
7        | Mathematics
6        | Computer Science, Physics, Electrical Engineering, Biology,
         | Architecture, Biomedical Engineering,
         | Biotechnology & Food Engineering, Chemical Engineering, Chemistry,
         | Civil & Environmental Engineering, Sciences Education,
         | Humanities, Industrial Engineering & Management, Materials Eng.,
         | Mechanical Engineering, Medicine

-- 
Nadav Har'El                        |         Monday, Sep 6 2004, 20 Elul 5764
[email-masked]             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |May you live as long as you want - and
http://nadav.harel.org.il           |never want as long as you live.

---

From: Arik Baratz <[email-masked]>
Date: Mon, 6 Sep 2004 16:19:52 +0300

>         grep "^Location: " | sed -n 's/^Location: pr\(.*\).gif/\1/; p'

Hi Nadav

It's a great site and a great idea! I even modified your script to run
on wget instead of curl:

wget --referer=$1 -O /dev/null -S
http://my.rank.online.fr/pagerank.php 2>&1 | grep '^Location:' | sed
-n 's/^Location: pr\(.*\).gif.*$/\1/; p'

-- Arik

---

From: "Nadav Har'El" <[email-masked]>
Date: Mon, 6 Sep 2004 16:25:28 +0300

> >         grep "^Location: " | sed -n 's/^Location: pr\(.*\).gif/\1/; p'

Looking again at my script, I'm a bit embarrassed - why use "sed -n" and "p"?
Stupid me. Here's the modified script, a few characters shorter :)

curl -e $1 -i http://my.rank.online.fr/pagerank.php 2>/dev/null |
grep "^Location: " | sed 's/^Location: pr\(.*\).gif/\1/'

-- 
Nadav Har'El                        |         Monday, Sep 6 2004, 20 Elul 5764
[email-masked]             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |ech`echo xiun|tr nu oc|sed
http://nadav.harel.org.il           |'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol