---
title: "Java版PageRank及网站收录情况查询代码"
author: "mmdev"
date: "2008-12-31T20:02:00Z"
tags: []
slug: "java-pagerank"
draft: false
lastmod: "2012-04-14T20:09:26Z"
id: 1486225
url: "https://mmdev.iteye.com/blog/1486225"
---

在Google这个由10的100次方得名的站点中，各种评估网站的算法层出不穷，而PageRank即是其中之一。

Google的PageRank根据网站的外部链接和内部链接的数量和质量俩衡量网站的价值。PageRank背后的概念是，每个到页面的链接都是对该页面的一次投票，被链接的越多，就意味着被其他网站投票越多。这个就是所谓的“链接流行度”——衡量多少人愿意将他们的网站和你的网站挂钩。PageRank这个概念引自学术中一篇论文的被引述的频度——即被别人引述的次数越多，一般判断这篇论文的权威性就越高。

通常情况下讲，原创内容越多的站点，PageRank越容易提升，反之则相对比较困难，PageRank最大上限值为10。在Google的评估中，能上10的网站真可谓凤毛麟角，即使算上Google，能成就PageRank 10这“伟业”者，望眼环球也不足40家。一般来说，个人站点评估值4即办的不错，商业网站到6以上便算步入正轨了。

网上虽然有不少现成的查询器及源码，但是光用别人的毕竟不符合程序员风格，所以今天自己用Java重造轮子又写了个PageRank查询实现，捎带着把一些常用搜索引擎的网站链接及反向链接查询也加上了。

**源码如下：**

**GooglePageRank.java**

001. packageorg.loon.test;
002. importjava.io.IOException;
003. importjava.util.Random;
004. importjava.util.regex.Matcher;
005. importjava.util.regex.Pattern;
006. /\**
007. \*Copyright2008
008. \*
009. \*LicensedundertheApacheLicense,Version2.0(the"License");youmaynot
010. \*usethisfileexceptincompliancewiththeLicense.Youmayobtainacopyof
011. \*theLicenseat
012. \*
013. \*http://www.apache.org/licenses/LICENSE-2.0
014. \*
015. \*Unlessrequiredbyapplicablelaworagreedtoinwriting,software
016. \*distributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUT
017. \*WARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.Seethe
018. \*Licenseforthespecificlanguagegoverningpermissionsandlimitationsunder
019. \*theLicense.
020. \*
021. \*@projectloonframework
022. \*@authorchenpeng
023. \*@email：ceponline@yahoo.com.cn
024. \*@version0.1
025. \*/
026. publicclassGooglePageRank{
027. //googlepagerank服务器ip地址列表（最近google小气了很多，反复查询一个封ip）
028. finalstaticString\[]GoogleServiceIP=newString\[]{"64.233.161.100",
029. "64.233.161.101","64.233.183.91","64.233.189.44","66.102.1.103",
030. "66.102.9.115","66.249.89.83","66.249.91.99","66.249.93.190"};
031. //google用识别标记
032. finalstaticprivateintGOOGLE\_MAGIC=0xE6359A60;
033. //ch数值混合器
034. privateclassCHMix{
035. inta;
036. intb;
037. intc;
038. publicCHMix(){
039. this(0,0,0);
040. }
041. publicCHMix(inta,intb,intc){
042. this.a=a;
043. this.b=b;
044. this.c=c;
045. }
046. }
047. /\**
048. \*按google要求混合成ch数据
049. \*
050. \*@parammix
051. \*/
052. privatestaticvoidmix(finalCHMixmix){
053. mix.a-=mix.b;
054. mix.a-=mix.c;
055. mix.a^=mix.c&gt;&gt;13;
056. mix.b-=mix.c;
057. mix.b-=mix.a;
058. mix.b^=mix.a&lt;&lt;8;
059. mix.c-=mix.a;
060. mix.c-=mix.b;
061. mix.c^=mix.b&gt;&gt;13;
062. mix.a-=mix.b;
063. mix.a-=mix.c;
064. mix.a^=mix.c&gt;&gt;12;
065. mix.b-=mix.c;
066. mix.b-=mix.a;
067. mix.b^=mix.a&lt;&lt;16;
068. mix.c-=mix.a;
069. mix.c-=mix.b;
070. mix.c^=mix.b&gt;&gt;5;
071. mix.a-=mix.b;
072. mix.a-=mix.c;
073. mix.a^=mix.c&gt;&gt;3;
074. mix.b-=mix.c;
075. mix.b-=mix.a;
076. mix.b^=mix.a&lt;&lt;10;
077. mix.c-=mix.a;
078. mix.c-=mix.b;
079. mix.c^=mix.b&gt;&gt;15;
080. }
081. /\**
082. \*获得ch数值混合器
083. \*
084. \*@return
085. \*/
086. publicstaticCHMixgetInnerCHMix(){
087. returnnewGooglePageRank().newCHMix();
088. }
089. /\**
090. \*通过url获得googlech(google数据库针对页面的全球唯一标识)
091. \*
092. \*@paramurl
093. \*@return
094. \*/
095. publicstaticStringGoogleCH(finalStringurl){
096. //格式化为google要求的info:url模式
097. StringnUrl=String.format("info:%s",newObject\[]{url});
098. //获得新url字符串格式
099. char\[]urls=nUrl.toCharArray();
100. //获得新url长度
101. intlength=urls.length;
102. //获得一个ch数值混合器
103. CHMixchMix=GooglePageRank.getInnerCHMix();
104. //为c注入google识别标识
105. chMix.c=GOOGLE\_MAGIC;
106. //为a、b项注入google要求的初始标识
107. chMix.a=chMix.b=0x9E3779B9;
108. intk=0;
109. intlen=length;
110. while(len&gt;=12){
111. chMix.a+=(int)(urls\[k+0]+(urls\[k+1]&lt;&lt;8)
112. +(urls\[k+2]&lt;&lt;16)+(urls\[k+3]&lt;&lt;24));
113. chMix.b+=(int)(urls\[k+4]+(urls\[k+5]&lt;&lt;8)
114. +(urls\[k+6]&lt;&lt;16)+(urls\[k+7]&lt;&lt;24));
115. chMix.c+=(int)(urls\[k+8]+(urls\[k+9]&lt;&lt;8)
116. +(urls\[k+10]&lt;&lt;16)+(urls\[k+11]&lt;&lt;24));
117. //获得混合运算后的数据
118. GooglePageRank.mix(chMix);
119. k+=12;
120. len-=12;
121. }
122. chMix.c+=length;
123. //产生googlech的11位标识
124. switch(len){
125. case11:
126. chMix.c+=(int)(urls\[k+10]&lt;&lt;24);
127. case10:
128. chMix.c+=(int)(urls\[k+9]&lt;&lt;16);
129. case9:
130. chMix.c+=(int)(urls\[k+8]&lt;&lt;8);
131. case8:
132. chMix.b+=(int)(urls\[k+7]&lt;&lt;24);
133. case7:
134. chMix.b+=(int)(urls\[k+6]&lt;&lt;16);
135. case6:
136. chMix.b+=(int)(urls\[k+5]&lt;&lt;8);
137. case5:
138. chMix.b+=(int)(urls\[k+4]);
139. case4:
140. chMix.a+=(int)(urls\[k+3]&lt;&lt;24);
141. case3:
142. chMix.a+=(int)(urls\[k+2]&lt;&lt;16);
143. case2:
144. chMix.a+=(int)(urls\[k+1]&lt;&lt;8);
145. case1:
146. chMix.a+=(int)(urls\[k+0]);
147. break;
148. default:
149. break;
150. }
151. //获得混合运算后的数据
152. GooglePageRank.mix(chMix);
153. //获得未修订的CH
154. Stringtch=String.valueOf(chMix.c);
155. //矫正差值后反馈正确CH
156. returnString
157. .format("6%s",newObject\[]{tch.length()&lt;10?("-"+tch)
158. .intern():tch});
159. }
160. /\**
161. \*正则匹配pagerank结果
162. \*
163. \*@paramvalue
164. \*@return
165. \*/
166. privatestaticStringMatchRank(finalStringvalue){
167. Patternpattern=Pattern.compile("Rank\_1:\[0-9]:(\[0-9]+)");
168. Matchermatcher=pattern.matcher(value);
169. if(matcher.find()){
170. returnmatcher.group(1);
171. }
172. return"0";
173. }
174. /\**
175. \*获得指定页面的googlepagerank值
176. \*
177. \*@paramurl
178. \*@return
179. \*/
180. publicstaticStringGooglePR(finalStringurl){
181. Stringrip=GoogleServiceIP[newRandom()
182. .nextInt(GoogleServiceIP.length)];
183. returnGooglePR(url,rip);
184. }
185. /\**
186. \*以指定的google服务器获得指定页面的googlepagerank值
187. \*
188. \*@paramurl
189. \*@paramip
190. \*@return
191. \*/
192. publicstaticStringGooglePR(finalStringurl,finalStringip){
193. //产生查询用唯一标识
194. Stringchecksum=GoogleCH(url);
195. //产生查询用url
196. StringqueryUrl=String
197. .format(
198. "http://%s/search?client=navclient-auto&ch=%s&features=Rank&q=info:%s",
199. newObject\[]{ip,checksum,url});
200. Stringresponse;
201. try{
202. response=SimpleWebClient.getRequestHttp(queryUrl);
203. }catch(IOExceptione){
204. response="";
205. }
206. if(response.length()==0){
207. return"0";
208. }else{
209. returnGooglePageRank.MatchRank(response);
210. }
211. }
212. }

**SimpleWebClient.java**

001. packageorg.loon.test;
002. importjava.io.BufferedInputStream;
003. importjava.io.ByteArrayOutputStream;
004. importjava.io.IOException;
005. importjava.io.InputStream;
006. importjava.io.InputStreamReader;
007. importjava.io.OutputStreamWriter;
008. importjava.net.HttpURLConnection;
009. importjava.net.URL;
010. importjava.util.HashMap;
011. importjava.util.Iterator;
012. importjava.util.Map;
013. importjava.util.Set;
014. importjava.util.Map.Entry;
015. importsun.misc.BASE64Encoder;
016. /\**
017. \*Copyright2008
018. \*
019. \*LicensedundertheApacheLicense,Version2.0(the"License");youmaynot
020. \*usethisfileexceptincompliancewiththeLicense.Youmayobtainacopyof
021. \*theLicenseat
022. \*
023. \*http://www.apache.org/licenses/LICENSE-2.0
024. \*
025. \*Unlessrequiredbyapplicablelaworagreedtoinwriting,software
026. \*distributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUT
027. \*WARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.Seethe
028. \*Licenseforthespecificlanguagegoverningpermissionsandlimitationsunder
029. \*theLicense.
030. \*
031. \*@projectloonframework
032. \*@authorchenpeng
033. \*@email：ceponline@yahoo.com.cn
034. \*@version0.1
035. \*/
036. publicclassSimpleWebClient{
037. /\**
038. \*向指定url发送请求并获得响应数据
039. \*
040. \*@paramurlString
041. \*@return
042. \*@throwsIOException
043. \*/
044. publicstaticStringgetRequestHttp(StringurlString)throwsIOException{
045. returngetRequestHttp(urlString,"utf-8");
046. }
047. /\**
048. \*向指定url发送请求并获得响应数据
049. \*
050. \*@paramurlString
051. \*@paramencoding
052. \*@return
053. \*@throwsIOException
054. \*/
055. publicstaticStringgetRequestHttp(StringurlString,Stringencoding)
056. throwsIOException{
057. returngetRequestHttp(urlString,encoding,null,5000);
058. }
059. /\**
060. \*向指定url发送请求并获得响应数据
061. \*
062. \*@paramurlString
063. \*@paramencoding
064. \*@paramparameter
065. \*@return
066. \*@throwsIOException
067. \*/
068. publicstaticStringgetRequestHttp(finalStringurlString,
069. finalStringencoding,finalMapparameter,finalinttimeout)
070. throwsIOException{
071. StringnURL=(urlString.startsWith("http://")||urlString
072. .startsWith("https://"))?urlString:("http:"+urlString)
073. .intern();
074. Stringuser=null;
075. Stringpassword=null;
076. Stringmethod="GET";
077. Stringpost=null;
078. Stringdigest=null;
079. StringresponseContent="ERROR";
080. booleanfoundRedirect=false;
081. Mapheaders=newHashMap();
082. if(parameter!=null){
083. SetentrySet=parameter.entrySet();
084. for(Iteratorit=entrySet.iterator();it.hasNext();){
085. Entryheader=(Entry)it.next();
086. Stringkey=(String)header.getKey();
087. Stringvalue=(String)header.getValue();
088. if("user".equals(key)){
089. user=value;
090. }elseif("pass".equals(key)){
091. password=value;
092. }elseif("method".equals(key)){
093. method=value;
094. }elseif("post".equals(key)){
095. post=value;
096. }else{
097. headers.put(key,value);
098. }
099. }
100. }
101. URLurl=newURL(nURL);
102. if(user!=null&&password!=null){
103. BASE64Encoderbase64=newBASE64Encoder();
104. digest="Basic"
105. +base64.encode((user+":"+password).getBytes());
106. }
107. do{
108. HttpURLConnectionurlConnection=(HttpURLConnection)url
109. .openConnection();
110. //添加访问授权
111. if(digest!=null){
112. urlConnection.setRequestProperty("Authorization",digest);
113. }
114. urlConnection.setDoOutput(true);
115. urlConnection.setDoInput(true);
116. urlConnection.setUseCaches(false);
117. urlConnection.setInstanceFollowRedirects(false);
118. urlConnection.setRequestMethod(method);
119. if(timeout&gt;0){
120. urlConnection.setConnectTimeout(timeout);
121. }
122. //模拟http头文件
123. urlConnection.setRequestProperty("User-Agent","Mozilla/4.0(compatible;MSIE7.0;)");
124. urlConnection.setRequestProperty("Accept","image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,application/x-shockwave-flash,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,\*/\*");
125. //追加http头文件
126. SetheadersSet=headers.entrySet();
127. for(Iteratorit=headersSet.iterator();it.hasNext();){
128. Entryentry=(Entry)it.next();
129. urlConnection.setRequestProperty((String)entry.getKey(),
130. (String)entry.getValue());
131. }
132. if(post!=null){
133. OutputStreamWriteroutRemote=newOutputStreamWriter(
134. urlConnection.getOutputStream());
135. outRemote.write(post);
136. outRemote.flush();
137. }
138. //获得响应状态
139. intresponseCode=urlConnection.getResponseCode();
140. //获得返回的数据长度
141. intresponseLength=urlConnection.getContentLength();
142. if(responseCode==302){
143. //重定向
144. Stringlocation=urlConnection.getHeaderField("Location");
145. url=newURL(location);
146. foundRedirect=true;
147. }else{
148. BufferedInputStreamin;
149. if(responseCode==200||responseCode==201){
150. in=newBufferedInputStream(urlConnection.getInputStream());
151. }else{
152. in=newBufferedInputStream(urlConnection.getErrorStream());
153. }
154. intsize=responseLength==-1?4096:responseLength;
155. if(encoding!=null){
156. responseContent=SimpleWebClient.read(in,size,encoding);
157. }else{
158. ByteArrayOutputStreamout=newByteArrayOutputStream();
159. byte\[]bytes=newbyte\[size];
160. intread;
161. while((read=in.read(bytes))&gt;=0){
162. out.write(bytes,0,read);
163. }
164. responseContent=newString(out.toByteArray());
165. in.close();
166. out.close();
167. }
168. foundRedirect=false;
169. }
170. //如果重定向则继续
171. }while(foundRedirect);
172. returnresponseContent;
173. }
174. /\**
175. \*转化InputStream为String
176. \*
177. \*@paramin
178. \*@paramsize
179. \*@return
180. \*@throwsIOException
181. \*/
182. privatestaticStringread(finalInputStreamin,finalintsize,
183. finalStringencoding)throwsIOException{
184. StringBuildersbr=newStringBuilder();
185. intnSize=size;
186. if(nSize==0){
187. nSize=1;
188. }
189. char\[]buffer=newchar\[nSize];
190. intoffset=0;
191. InputStreamReaderisr=newInputStreamReader(in,encoding);
192. while((offset=isr.read(buffer))!=-1){
193. sbr.append(buffer,0,offset);
194. }
195. in.close();
196. isr.close();
197. returnsbr.toString();
198. }
199. }

**WebAppraise.java**

001. packageorg.loon.test;
002. importjava.io.IOException;
003. /\**
004. \*Copyright2008
005. \*
006. \*LicensedundertheApacheLicense,Version2.0(the"License");youmaynot
007. \*usethisfileexceptincompliancewiththeLicense.Youmayobtainacopyof
008. \*theLicenseat
009. \*
010. \*http://www.apache.org/licenses/LICENSE-2.0
011. \*
012. \*Unlessrequiredbyapplicablelaworagreedtoinwriting,software
013. \*distributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUT
014. \*WARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.Seethe
015. \*Licenseforthespecificlanguagegoverningpermissionsandlimitationsunder
016. \*theLicense.
017. \*
018. \*@projectloonframework
019. \*@authorchenpeng
020. \*@email：ceponline@yahoo.com.cn
021. \*@version0.1
022. \*/
023. publicclassWebAppraise{
024. privateStringgoogleSum;
025. privateStringbaiduSum;
026. privateStringmsnSum;
027. privateStringaltaVistaSum;
028. privateStringallTheWebSum;
029. privateStringyahooSum;
030. privateStringtestURL;
031. publicWebAppraise(finalStringurl){
032. if(url!=null&&!"".equals(url)){
033. this.testURL=url.trim();
034. if(this.testURL.startsWith("http://")){
035. this.testURL=this.testURL.substring(7);
036. }
037. if(this.testURL.startsWith("https://")){
038. this.testURL=this.testURL.substring(8);
039. }
040. }else{
041. thrownewRuntimeException("urlisNULL!");
042. }
043. }
044. /\**
045. \*分析指定链接结果，并返回整型数值
046. \*
047. \*@paramsearchURL
048. \*@paramanchor
049. \*@paramtrail
050. \*@return
051. \*/
052. privatestaticintgetLinks(finalStringsearchURL,finalStringanchor,
053. finalStringtrail){
054. intcount=0;
055. StringserverResponse;
056. try{
057. //我国特色……
058. if(searchURL.startsWith("http://www.baidu.com")){
059. //永不离休的gb2312同志(-\_-||)
060. serverResponse=SimpleWebClient.getRequestHttp(searchURL,
061. "gb2312");
062. }else{
063. serverResponse=SimpleWebClient.getRequestHttp(searchURL);
064. }
065. }catch(IOExceptione){
066. serverResponse=e.getMessage();
067. }
068. intpos=serverResponse.indexOf(anchor);
069. if(pos&gt;1){
070. serverResponse=serverResponse.substring(pos+anchor.length());
071. pos=serverResponse.indexOf(trail);
072. Stringvalue=serverResponse.substring(0,pos).trim();
073. value=value.replace(",","");
074. value=value.replace(".","");
075. count=Integer.parseInt(value);
076. }
077. returncount;
078. }
079. publicStringgetAllTheWebSite(){
080. returngetAllTheWebSite(false);
081. }
082. publicStringgetAllTheWebSite(booleanisDomain){
083. try{
084. StringallTheWeb;
085. if(isDomain){
086. allTheWeb="http://www.alltheweb.com/search?cat=web&cs=utf8&rys=0&itag=crv&\_sb\_lang=any&q=linkdomain%3A"
087. +this.testURL;
088. }else{
089. allTheWeb="http://www.alltheweb.com/search?cat=web&cs=utf-8&q=link%3Ahttp%3A%2F%2F"
090. +this.testURL+"&\_sb\_lang=any";
091. }
092. allTheWebSum=""
093. +getLinks(allTheWeb,"&lt;spanclass=/"ofSoMany/"&gt;",
094. "&lt;/span&gt;");
095. }catch(Exceptionex){
096. allTheWebSum=ex.getMessage();
097. }
098. returnallTheWebSum;
099. }
100. publicStringgetAltaVistaSite(){
101. returngetAltaVistaSite(false);
102. }
103. publicStringgetAltaVistaSite(booleanisDomain){
104. try{
105. StringaltaVista;
106. if(isDomain){
107. altaVista="http://www.altavista.com/web/results?itag=ody&q=link%3A"
108. +this.testURL+"&kgs=0&kls=0";
109. }else{
110. altaVista="http://www.altavista.com/web/results?itag=ody&kgs=0&kls=0&q=site%3A"
111. +this.testURL;
112. }
113. altaVistaSum=""+getLinks(altaVista,"AltaVistafound","");
114. }catch(Exceptionex){
115. altaVistaSum=ex.getMessage();
116. }
117. returnaltaVistaSum;
118. }
119. publicStringgetGooglePR(){
120. returnGooglePageRank.GooglePR(this.testURL);
121. }
122. publicStringgetGoogleSite(){
123. returngetGoogleSite(false);
124. }
125. publicStringgetGoogleSite(finalbooleanisDomian){
126. try{
127. Stringgoogle;
128. //反向链接
129. if(isDomian){
130. google="http://www.google.com/search?hl=en&q=link%3A"
131. +this.testURL;
132. }else{
133. google="http://www.google.com/search?hl=en&q=site%3A"
134. +this.testURL+"&btnG=Google+Search&aq=f&oq=";
135. }
136. googleSum=""+getLinks(google,"about&lt;b&gt;","&lt;/b&gt;");
137. }catch(Exceptionex){
138. googleSum=ex.getMessage();
139. }
140. returngoogleSum;
141. }
142. publicStringgetBaiduSite(){
143. returngetBaiduSite(false);
144. }
145. publicStringgetBaiduSite(finalbooleanisDomian){
146. try{
147. Stringbaidu;
148. if(isDomian){
149. baidu="http://www.baidu.com/s?wd=domain%3A"+this.testURL
150. +"&cl=3";
151. }else{
152. baidu="http://www.baidu.com/s?wd=site%3A"+this.testURL;
153. }
154. baiduSum=""+getLinks(baidu,"找到相关网页","篇");
155. }catch(Exceptionex){
156. Stringbaidu;
157. if(isDomian){
158. baidu="http://www.baidu.com/s?wd=domain%3A"+this.testURL
159. +"&cl=3";
160. }else{
161. baidu="http://www.baidu.com/s?wd=site%3A"+this.testURL;
162. }
163. baiduSum=""+getLinks(baidu,"找到相关网页约","篇");
164. }
165. returnbaiduSum;
166. }
167. publicStringgetYahooSite(){
168. returngetYahooSite(false);
169. }
170. publicStringgetYahooSite(finalbooleanisDomian){
171. try{
172. Stringyahoo;
173. if(isDomian){
174. yahoo="http://sitemap.cn.yahoo.com/search?p="+this.testURL
175. +"&bwm=i";
176. yahooSum=""+getLinks(yahoo,"&lt;strong&gt;","&lt;/strong&gt;");
177. }else{
178. yahoo="http://www.yahoo.cn/s?p=site%3A"+this.testURL
179. +"&pid=hp&v=web";
180. yahooSum=""+getLinks(yahoo,"找到相关网页约","条");
181. }
182. }catch(Exceptionex){
183. yahooSum=ex.getMessage();
184. }
185. returnyahooSum;
186. }
187. publicStringgetMsnSite(){
188. returngetMsnSite(false);
189. }
190. publicStringgetMsnSite(booleanisDomain){
191. try{
192. Stringmsn;
193. if(isDomain){
194. msn="http://cnweb.search.live.com/results.aspx?q=link%3A"
195. +this.testURL+"&mkt=zh-cn&scope=&FORM=LIVSO";
196. }else{
197. msn="http://cnweb.search.live.com/results.aspx?q=site%3A"
198. +this.testURL+"&go=&form=QBRE";
199. }
200. msnSum=""+getLinks(msn,"共","条搜索结果");
201. }catch(Exceptionex){
202. msnSum=ex.getMessage();
203. }
204. returnmsnSum;
205. }
206. publicStringgetTestURL(){
207. returntestURL;
208. }
209. }

**Test.java**

01. packageorg.loon.test;
02. /\**
03. \*Copyright2008
04. \*
05. \*LicensedundertheApacheLicense,Version2.0(the"License");youmaynot
06. \*usethisfileexceptincompliancewiththeLicense.Youmayobtainacopyof
07. \*theLicenseat
08. \*
09. \*http://www.apache.org/licenses/LICENSE-2.0
10. \*
11. \*Unlessrequiredbyapplicablelaworagreedtoinwriting,software
12. \*distributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUT
13. \*WARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.Seethe
14. \*Licenseforthespecificlanguagegoverningpermissionsandlimitationsunder
15. \*theLicense.
16. \*
17. \*@projectloonframework
18. \*@authorchenpeng
19. \*@email：ceponline@yahoo.com.cn
20. \*@version0.1
21. \*/
22. publicclassTest{
23. publicstaticvoidmain(String\[]args){
24. WebAppraiseappraise=newWebAppraise("http://blog.csdn.net/cping1982");
25. System.out.println("GooglePagerRank值："+appraise.getGooglePR());
26. System.out.println("google收录："+appraise.getGoogleSite());
27. System.out.println("google反向收录："+appraise.getGoogleSite(true));
28. System.out.println("yahoo收录："+appraise.getYahooSite());
29. System.out.println("yahoo反向收录："+appraise.getYahooSite(true));
30. System.out.println("baidu收录："+appraise.getBaiduSite());
31. System.out.println("baidu反向收录："+appraise.getBaiduSite(true));
32. System.out.println("msn收录："+appraise.getMsnSite());
33. System.out.println("msn反向收录："+appraise.getMsnSite(true));
34. System.out.println("AllTheWeb收录："+appraise.getAllTheWebSite());
35. System.out.println("AllTheWeb反向收录："+appraise.getAllTheWebSite(true));
36. System.out.println("AltaVista收录："+appraise.getAltaVistaSite());
37. System.out.println("AltaVista反向收录："+appraise.getAltaVistaSite(true));
38. }
39. }

检测[http://blog.csdn.net/cping1982](http://blog.csdn.net/cping1982)运行结果如下图：

![](http://p.blog.csdn.net/images/p_blog_csdn_net/cping1982/EntryImages/20081231/20081231_pagerank_00.gif)

**源码下载地址：[http://download.csdn.net/source/929348](http://download.csdn.net/source/929348)**