Re: [問題] 用URL抓網頁
※ 引述《master0101 (master)》之銘言:
: 我使用URL的方式
: 想要抓一個網址的內容
: 但是握跑出來的結果跟我想要的結果是不一樣的
: try {
: URL google = new URL(url);
: InputStreamReader is = new InputStreamReader(google.openConnection()
: .getInputStream());
: BufferedReader in = new BufferedReader(is);
: while (in.ready())
: System.out.println (in.readLine());
: }
: catch (Exception e) {System.exit(0);}
^^^^^^^^^^^^^^^
Exception 還是乖乖印出來
至少在開發階段 or 遇到 bug 的時候,這是首要懷疑對象
: 我的url是
: "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?cmd=search&db=pubmed&retmax=50&RetStart=0&term=(Cardiovascular
: Diseases[MeSH Terms])+AND+(\"1990/01/01\"[Publication Date] :
: \"2000/01/01\"[Publication Date])+AND+(hasabstract[text])+AND+(English[lang])"
有時候不是只會寫程式就夠了
domain knowledge 還是很重要的
(最近在弄 DCT,深深覺得,當年一直躲避數學課的報應來了....)
請去仔細看一下 URL 這個 class 的 API 的說明
(關鍵字:foo.com [大笑])
最後,希望你以後能一次到位
可以把問題需要的東西都一次準備好
--
侃侃長論鮮窒礙 首頁:http://www.psmonkey.idv.tw
眾目睽睽無心顫 Blog:http://ps-think.blogspot.com
煢居少聊常人事
殺頭容易告白難 歡迎參觀 Java 版(@ptt.cc)精華區 \囧/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.114.194.216
→
09/02 17:43, , 1F
09/02 17:43, 1F
→
09/02 17:47, , 2F
09/02 17:47, 2F
推
09/02 21:56, , 3F
09/02 21:56, 3F
→
09/03 01:33, , 4F
09/03 01:33, 4F
討論串 (同標題文章)