{"id":1530,"date":"2013-05-30T08:01:39","date_gmt":"2013-05-30T08:01:39","guid":{"rendered":"http:\/\/www.web2seo.cn\/?p=66"},"modified":"2013-05-30T08:01:39","modified_gmt":"2013-05-30T08:01:39","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python-%e6%89%b9%e9%87%8f%e8%8e%b7%e5%8f%96google-pr%e5%80%bc","status":"publish","type":"post","link":"https:\/\/86i87.com\/?p=1530","title":{"rendered":"\u5982\u4f55\u7528Python \u6279\u91cf\u83b7\u53d6Google PR\u503c"},"content":{"rendered":"<p>\u7f51\u4e0a\u627e\u6765\u7684~~~,\u51c6\u786e\u8bf4\u662f\u7f51\u4e0a\u6512\u8d77\u6765\u7684\uff0c\u7efc\u5408\u4e86<a href=\"http:\/\/www.schurpf.com\/google-pagerank-python\/\">http:\/\/www.schurpf.com\/google-pagerank-python\/<\/a> \u548c <a href=\"http:\/\/www.cnpythoner.com\/post\/190.html\">http:\/\/www.cnpythoner.com\/post\/190.html<\/a> \u8fd9\u4e24\u4f4d\u5927\u5927\u7684\u6210\u679c\uff0c\u5f88\u660e\u663e\u8fd9\u4e2a\u7a0b\u5e8f\u8fd8\u662f\u6709\u5f88\u5927\u6539\u8fdb\u7684\u7a7a\u95f4\uff0c\u53ef\u60dc\u6211\u529b\u6b62\u4e8e\u6b64\u554a\uff0c\u597d\u6b79\u4e5f\u662f\u7b2c\u4e00\u6b21\u73a9Python\uff0c\u82b1\u4e86\u597d\u51e0\u4e2a\u793c\u62dc\u641e\u6210\u8fd9\u6837\u4e0d\u6613\u554a\u3002<\/p>\n<pre class=\"de1\">import re,urllib,httplib,time\nprhost='toolbarqueries.google.com'\nprpath='\/tbr?client=navclient-auto&amp;ch=%s&amp;features=Rank&amp;q=info:%s'\n\ndef get_url(url):\n\n    host_re  = re.compile(r'^https?:\/\/(.*?)($|\/)',\n                       re.IGNORECASE\n                   )\n\n    return host_re.search(url).group(0)[7:-1]\n\ndef GetHash (url):\n    SEED = \"Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.\"\n    Result = 0x01020345\n    for i in range(len(url)) :\n        Result ^= ord(SEED[i%len(SEED)]) ^ ord(url[i])\n        Result = Result &gt;&gt; 23 | Result &lt;&lt; 9\n        Result &amp;= 0xffffffff\n    return '8%x' % Result\n\ndef GetPageRank (url):\n    keyinfo =  GetHash (url)\n    opener = urllib.FancyURLopener()\n    hosturl = \"http:\/\/toolbarqueries.google.com\/tbr?client=navclient-auto&amp;ch=%s&amp;features=Rank&amp;q=info:%s\" % (keyinfo,url)\n    info = opener.open(hosturl).read()\n    cinfo = info.decode('utf-8').encode('gbk')\n    prnum = cinfo[9:10]\n    print prnum\n    return prnum\n\nf = file('D:\\pr7.txt','w')\n\nfor m in file('D:\\info7.txt','r'):\n    murl = m.strip()\n#    checkurl = get_url(murl)\n    try:\n        prnum = GetPageRank(murl)\n    except Exception,e:\n        prnum = -1\n        content = \"%s,%s\\n\" % (murl,prnum)\n        f.write(content)\n        continue\n    else:\n        content = \"%s,%s\\n\" % (murl,prnum)\n        f.write(content)\n        time.sleep(5)\n\nf.close()<\/pre>\n<div><\/div>\n<pre class=\"de1\">\u8fd9\u6bb5\u4ee3\u7801\u6709\u610f\u601d\u7684\u662f\u4e2d\u95f4\u7684\u4e00\u6bb5\u8bed\u53e5Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer\uff0c<\/pre>\n<pre class=\"de1\">\u7ffb\u8bd1\u6210\u4e2d\u6587\u662f\u201c\u91c7\u96c6PR\u503c\u8fdd\u53cd\u8c37\u6b4c\u7684\u7528\u6237\u534f\u8bae\uff0c\u6ca1\u9519\uff0c\u8bf4\u5f97\u5c31\u662f\u4f60\u8fd9\u4e2a\u8d31\u4eba\uff01\u201d\u597d\u5427\uff0c\u636e\u6211\u5206\u6790\u8fd9\u6bb5\u4ee3\u7801\u662f\u4e3a\u4e86\u83b7\u53d6\u4e00\u4e2a\u5bc6\u94a5\uff0c\u7136\u540e\u62fc\u5230URL\u91cc\u67e5\u8be2page rank\uff0c\u53ea\u662f\u4e0d\u89e3<\/pre>\n<pre class=\"de1\">\u4e3a\u4f55\u7528\u8fd9\u6bb5\u8bdd....<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u4e0a\u627e\u6765\u7684~~~,\u51c6\u786e\u8bf4\u662f\u7f51\u4e0a\u6512\u8d77\u6765\u7684\uff0c\u7efc\u5408\u4e86http:\/\/www.schurpf.com\/google-pagerank-python\/ \u548c http:\/\/www.cnpythoner.com\/post\/190.html \u8fd9\u4e24\u4f4d\u5927\u5927\u7684\u6210\u679c\uff0c\u5f88\u660e\u663e\u8fd9\u4e2a\u7a0b\u5e8f\u8fd8\u662f\u6709\u5f88\u5927\u6539\u8fdb\u7684\u7a7a\u95f4\uff0c\u53ef\u60dc\u6211\u529b\u6b62\u4e8e\u6b64\u554a\uff0c\u597d\u6b79\u4e5f\u662f\u7b2c\u4e00\u6b21\u73a9Python\uff0c\u82b1\u4e86\u597d\u51e0\u4e2a\u793c\u62dc\u641e\u6210\u8fd9\u6837\u4e0d\u6613\u554a\u3002 import re,urllib,httplib,time prhost=&#8217;toolbarqueries.google.com&#8217; prpath=&#8217;\/tbr?client=navclient-auto&amp;ch=%s&amp;features=Rank&amp;q=info:%s&#8217; def get_url(url): host_re = re.compile(r&#8217;^https?:\/\/(.*?)($|\/)&#8217;, re.IGNORECASE ) return host_re.search(url).group(0)[7:-1] def GetHash (url): SEED = &#8220;Mining PageRank is AGAINST GOOGLE&#8217;S TERMS OF SERVICE&#8230;.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1530","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/86i87.com\/index.php?rest_route=\/wp\/v2\/posts\/1530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/86i87.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/86i87.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/86i87.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/86i87.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1530"}],"version-history":[{"count":0,"href":"https:\/\/86i87.com\/index.php?rest_route=\/wp\/v2\/posts\/1530\/revisions"}],"wp:attachment":[{"href":"https:\/\/86i87.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/86i87.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/86i87.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}