summaryrefslogtreecommitdiffstats
path: root/prank
blob: 125e9d24f026da5b04ef464c9cf9d11e4c60ccc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

#
# prank.sh - Find any URL's Google Page Rank (PR)
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if [ $# -ne 1 ]
then
 echo "Usage: $0 HttpOrHttpsURL\n"
 exit 1
fi

pr_checksum_prog="pagerank"

if [ ! -x $pr_checksum_prog ]
then
 echo "Cannot Find Checksum Program: $pr_checksum_prog !"
 exit 2
fi

wget=/usr/bin/wget
prank_url=$1
mod_prank_url=`echo $prank_url|sed -e 's/:/%3A/g' -e 's/\//%2F/g'`
prank_checksum=`$pr_checksum_prog $prank_url|sed 's/Checksum=//'`

prank_qurl="http://toolbarqueries.google.com/search?client=navclient-auto&ch=${prank_checksum}&ie=UTF-8&oe=UTF-8&features=Rank&q=info:${mod_prank_url}"

echo -n "Google PR For $prank_url = "

$wget -nv -O - "$prank_qurl" 2>&1|grep "Rank_"|sed 's/Rank_[0-9]:[0-9]://'
exit 0