大虾们,求帮助……用httpclient进行获取微信搜狗公众号文章问题,
/gzhjs?cb=sogou.weixin.gzhcb&openid=oIWsFtyoPnoKxqvND4ufXLQ-4SRc&page=1该地址如频繁调用微信搜狗会限制查询,返回的结果不对,求指导……
try{
HttpClientclient=newDefaultHttpClient();
HttpGethttpGet=newHttpGet("/gzhjs?cb=sogou.weixin.gzhcb&openid=oIWsFtyoPnoKxqvND4ufXLQ-4SRc&page=1");
StringBufferstrBuf=newStringBuffer();
HttpResponseresponse=client.execute(httpGet);
if(HttpStatus.SC_OK==response.getStatusLine().getStatusCode()){
HttpEntityentity=response.getEntity();
if(entity!=null){
BufferedReaderreader=newBufferedReader(
newInputStreamReader(entity.getContent(),"UTF-8"));
Stringline=null;
if(entity.getContentLength()>0){
strBuf=newStringBuffer((int)entity.getContentLength());
while((line=reader.readLine())!=null){
strBuf.append(line);
}
}
}
if(entity!=null){
entity.consumeContent();
}
}
System.out.println(strBuf.toString());
}catch(Throwablet){
System.out.println(t.toString());
t.printStackTrace();
}
访问频繁后连接会返回如下结果:并不是文章信息。
charset=ISO-8859-1
HttpMethodBase-Goingtobufferresponsebodyoflargeorunknownsize.UsinggetResponseBodyAsStreaminsteadisrecommended.
varuri=document.location.href;
varpos=uri.indexOf("?");
if(pos!=-1)uri=uri.substr(0,pos);
vardomain=".";
if(uri.indexOf("")>-1)domain=".";
vardate=newDate();
if(document.cookie.indexOf("SUV=")<0)
document.cookie="SUV="+(date.getTime())*1000+Math.round(Math.random()*1000)+";path=/;expires=Sun,29July204600:00:00UTC;domain="+domain;
date.setTime(date.getTime()+5*24*3600*1000);//2tian
document.cookie="SNUID=25489A3D898F9BD9987AC9D68A8B356D;path=/;expires="+date.toGMTString();
document.location.href="/gzhjs?cb=sogou.weixin.gzhcb&openid=oIWsFtyoPnoKxqvND4ufXLQ-4SRc&page=1&t=1427522889323&repp=1";