– Get google PageRank with python

I spend several hours trying to find a python script that would return google PageRank with a python script. There seems to be a script out there that was working in 2010 from Corey Goldberg. It is not working for me. I looked around for quite a bit till I found a python script on GitHub. The script is sponsored by Phurix and uses toolbar queries. I decided to republish it with a small modification:

#!/usr/bin/env python

# Google Pagerank Checksum Algorithm (Firefox Toolbar)
# Downloaded from
# Requires: Python >= 2.4

# Versions:
# 0.2 - Fixed a minor formatting bug
# 0.1 - Public release

# Settings

# Function definitions
def GetHash (query):
    SEED = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer."
    Result = 0x01020345
    for i in range(len(query)) :
        Result ^= ord(SEED[i%len(SEED)]) ^ ord(query[i])
        Result = Result >> 23 | Result << 9
        Result &= 0xffffffff
    return '8%x' % Result

def GetPageRank (query):
    import httplib
    conn = httplib.HTTPConnection(prhost)
    hash = GetHash(query)
    path = prpath % (hash,query)
    conn.request("GET", path)
    response = conn.getresponse()
    data =
    return data.split(":")[-1]

if __name__ == "__main__" :
    print GetPageRank("")

I did modify the original script a tiny bit to only return the page rank as a string. That is it. I hope it helps you, let me know comments or questions and I will try to answer as good as I can.

The perfect season to resolve soundness problem is before any visible sign appears. Actually there isn’t anything you can’t purchase on the Internet anymore. Whereas erectile malfunction is more common among older men, that doesn’t some you merely have to live with. What about “canadian pharmacy cialis 5 mg” and “cialis canadian pharmacy“? In our generation, there are divers options for those ones who suffer from erectile malfunction. You may have heard about “canadian pharmacy online cialis“. More info about the problem available at “canadian pharmacy cialis 20mg“. Why it happen? Can sexual disorders in men be prevented? If you get any prescription remedies like Viagra, check with a pharmacist that they are sure to take with your other remedies.

The Top 8 WordPress Developer Tools from 5 years experience
(Hint: They cut down my development time in less than half!)

Get the Top Tools Now!


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.