[問題] 抓取無名 html 原始碼
請問各位一個關於從 url 抓取 html 原始檔的問題.
透過一下 java 程式碼, 若將 URL 內的字串改為 "http://www.google.com"
是可以抓得到 google 首頁原始碼的.
然而, 若要以相同的方法抓取無名的網頁,
似乎沒辦法抓下來 ?
請問要如何修改才能取得無名網頁的 html 檔呢 ?
謝謝 ~
try {
URL html = new URL ("http://www.wretch.cc/album/test");
InputStreamReader is = new InputStreamReader(html.openStream());
BufferedReader in = new BufferedReader(is);
while (in.ready()){
System.out.println(in.readLine());
}
} catch (Exception e) {System.exit(0);}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.119.192.213