我想獲得網站Examp的所有頁面內容:http://academic.research.microsoft.com/Author/1789765/hoang-kiem?query=hoang%20kiem我如何獲取所有頁面內容?
我用這個代碼:
String getResults(URL source) throws IOException {
InputStream in = source.openStream();
StringBuffer sb = new StringBuffer();
byte[] buffer = new byte[256];
while(true) {
int bytesRead = in.read(buffer);
if(bytesRead == -1) break;
for (int i=0; i<bytesRead; i++)
sb.append((char)buffer[i]);
}
return sb.toString();
}
但結果丟失了一些信息,例如關於作者的一些提示,如下圖所示
你能給我一些建議!謝謝
謝謝,我如何獲得該內容? – tiendv
Selenium是一個ui測試框架,也可以用於webscraping:http://seleniumhq.org/ –