htmlparser实现从网页上抓取数据
package parser;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
/**
* 基本能实现网页抓取,不过要手动输入URL 将整个html内容保存到指定文件
*
*@author chenguoyong
*
*/
public class ScrubSelectedWeb {
privatefinal static String CRLF = System.getProperty("line.separator");
/**
* @param args
*/
publicstatic void main(String[] args) {
try{
URLur = newURL("http://10.249.187.199:8083/injs100/");
InputStreaminstr = ur.openStream();
Strings, str;
BufferedReaderin = new BufferedReader(new InputStreamReader(instr));
StringBuffersb = new StringBuffer();
BufferedWriterout = new BufferedWriter(new FileWriter(
"D:/outPut.txt"));
while((s = in.readLine()) != null) {
sb.append(s+ CRLF);
}
System.out.println(sb);
str= new String(sb);
out.write(str);
out.close();
in.close();
}catch (MalformedURLException e) {
e.printStackTrace();
}catch (IOException e) {
http://tieba.baidu.com/p/3476776824
http://c.tieba.baidu.com/p/3343932442
http://c.tieba.baidu.com/p/3343933631
http://c.tieba.baidu.com/p/3360004131
http://c.tieba.baidu.com/p/3360025086
http://c.tieba.baidu.com/p/3360026002
http://c.tieba.baidu.com/p/3360026990
http://c.tieba.baidu.com/p/3360035622
http://c.tieba.baidu.com/p/3360039612
http://c.tieba.baidu.com/p/3360042452
http://c.tieba.baidu.com/p/3360043626
http://c.tieba.baidu.com/p/3360044870
http://c.tieba.baidu.com/p/3360066307
http://c.tieba.baidu.com/p/3360074347
http://c.tieba.baidu.com/p/3330440337
http://c.tieba.baidu.com/p/3330447685
http://c.tieba.baidu.com/p/3330447102
http://c.tieba.baidu.com/p/3330446783
http://c.tieba.baidu.com/p/3330445786
http://c.tieba.baidu.com/p/3330443346
http://c.tieba.baidu.com/p/3330442439
http://c.tieba.baidu.com/p/3330441983
http://c.tieba.baidu.com/p/3330441429
http://c.tieba.baidu.com/p/3348149393
http://c.tieba.baidu.com/p/3348153576
http://c.tieba.baidu.com/p/3348161854
http://c.tieba.baidu.com/p/3348157377
http://c.tieba.baidu.com/p/3361120824
http://c.tieba.baidu.com/p/3348165622
http://c.tieba.baidu.com/p/3348179673
http://c.tieba.baidu.com/p/3330439952
http://c.tieba.baidu.com/p/3361121467
http://c.tieba.baidu.com/p/3361122617
http://c.tieba.baidu.com/p/3361173026
http://c.tieba.baidu.com/p/3361123998
http://c.tieba.baidu.com/p/3361127689
http://c.tieba.baidu.com/p/3361169237
http://c.tieba.baidu.com/p/3409866665
http://c.tieba.baidu.com/p/3409873864
http://c.tieba.baidu.com/p/3409879998
http://c.tieba.baidu.com/p/3361170830
http://c.tieba.baidu.com/p/3361180984
http://c.tieba.baidu.com/p/3361143277
http://c.tieba.baidu.com/p/3344753075
http://c.tieba.baidu.com/p/3344759431
http://c.tieba.baidu.com/p/3344768613
http://c.tieba.baidu.com/p/3344763448
http://c.tieba.baidu.com/p/3344767101
http://c.tieba.baidu.com/p/3344767907
http://c.tieba.baidu.com/p/3372410915
http://c.tieba.baidu.com/p/3372410915
http://c.tieba.baidu.com/p/3369940353
http://c.tieba.baidu.com/p/3361165940
http://c.tieba.baidu.com/p/3330444191
http://c.tieba.baidu.com/p/3453252255
http://c.tieba.baidu.com/p/3387728228
http://c.tieba.baidu.com/p/3455731953
http://c.tieba.baidu.com/p/3409795327
http://c.tieba.baidu.com/p/3409791516
http://c.tieba.baidu.com/p/3409787667
http://c.tieba.baidu.com/p/3409767728
http://c.tieba.baidu.com/p/3393319887
http://c.tieba.baidu.com/p/3393289119
http://c.tieba.baidu.com/p/3408720123
http://c.tieba.baidu.com/p/3408719221
http://c.tieba.baidu.com/p/3408718072
http://c.tieba.baidu.com/p/3405066327
http://c.tieba.baidu.com/p/3405064465
http://c.tieba.baidu.com/p/3387719787
http://c.tieba.baidu.com/p/3361144327
http://c.tieba.baidu.com/p/3387721703
http://c.tieba.baidu.com/p/3387722769
http://c.tieba.baidu.com/p/3330446425
http://c.tieba.baidu.com/p/3393438082
http://c.tieba.baidu.com/p/3360067141
http://c.tieba.baidu.com/p/3360070408
http://c.tieba.baidu.com/p/3360079428
http://c.tieba.baidu.com/p/3360076598
http://c.tieba.baidu.com/p/3360095693
http://c.tieba.baidu.com/p/3360078291
http://c.tieba.baidu.com/p/3360074347
http://c.tieba.baidu.com/p/3360066307
http://c.tieba.baidu.com/p/3330444191
http://c.tieba.baidu.com/p/3330439143
http://c.tieba.baidu.com/p/3330447685
http://c.tieba.baidu.com/p/3330445786
http://c.tieba.baidu.com/p/3330442439
http://c.tieba.baidu.com/p/3330439614
http://c.tieba.baidu.com/p/3330441983
http://c.tieba.baidu.com/p/3330440337
http://c.tieba.baidu.com/p/3330441429
http://c.tieba.baidu.com/p/3330447102
http://c.tieba.baidu.com/p/3330446783
http://c.tieba.baidu.com/p/3361170830
http://c.tieba.baidu.com/p/3361180984
http://c.tieba.baidu.com/p/3361127689
http://c.tieba.baidu.com/p/3410122313
http://c.tieba.baidu.com/p/3361165940
http://c.tieba.baidu.com/p/3348161854
http://c.tieba.baidu.com/p/3330443346
http://c.tieba.baidu.com/p/3361122617
http://c.tieba.baidu.com/p/3361121467
http://c.tieba.baidu.com/p/3348179673
http://c.tieba.baidu.com/p/3348157377
http://c.tieba.baidu.com/p/3348153576
http://c.tieba.baidu.com/p/3348165622
http://c.tieba.baidu.com/p/3348149393
http://c.tieba.baidu.com/p/3361120824
http://c.tieba.baidu.com/p/3455731953
http://c.tieba.baidu.com/p/3453252255
http://c.tieba.baidu.com/p/3453246705
http://c.tieba.baidu.com/p/3343072625
http://c.tieba.baidu.com/p/3353634819
http://c.tieba.baidu.com/p/3410605225
http://c.tieba.baidu.com/p/3387721703
http://c.tieba.baidu.com/p/3387719787
http://c.tieba.baidu.com/p/3414013033
http://c.tieba.baidu.com/p/3354354914
http://c.tieba.baidu.com/p/3354297069
http://c.tieba.baidu.com/p/3354527799
http://c.tieba.baidu.com/p/3354563874
http://c.tieba.baidu.com/p/3354546842
http://c.tieba.baidu.com/p/3354329758
http://c.tieba.baidu.com/p/3354251795
http://c.tieba.baidu.com/p/3354370368
http://c.tieba.baidu.com/p/3354357165
http://c.tieba.baidu.com/p/3354300027
http://c.tieba.baidu.com/p/3354534701
http://c.tieba.baidu.com/p/3354547666
http://c.tieba.baidu.com/p/3354566167
http://c.tieba.baidu.com/p/3354328957
http://c.tieba.baidu.com/p/3354255255
http://c.tieba.baidu.com/p/3354358425
http://c.tieba.baidu.com/p/3354386728
http://c.tieba.baidu.com/p/3354309420
http://c.tieba.baidu.com/p/3354536371
http://c.tieba.baidu.com/p/3354574673
http://c.tieba.baidu.com/p/3354557382
http://c.tieba.baidu.com/p/3354247248
http://c.tieba.baidu.com/p/3354339313
http://c.tieba.baidu.com/p/3354259808
http://c.tieba.baidu.com/p/3354493596
http://c.tieba.baidu.com/p/3354362725
http://c.tieba.baidu.com/p/3354313871
http://c.tieba.baidu.com/p/3354537993
http://c.tieba.baidu.com/p/3354250060
http://c.tieba.baidu.com/p/3354575677
http://c.tieba.baidu.com/p/3354351963
http://c.tieba.baidu.com/p/3354511292
http://c.tieba.baidu.com/p/3354289895
http://c.tieba.baidu.com/p/3354558402
http://c.tieba.baidu.com/p/3354319537
http://c.tieba.baidu.com/p/3354363645
http://c.tieba.baidu.com/p/3350289085
http://c.tieba.baidu.com/p/3353721933
http://c.tieba.baidu.com/p/3350456016
http://c.tieba.baidu.com/p/3351037171
http://c.tieba.baidu.com/p/3350363233
http://c.tieba.baidu.com/p/3350349898
http://c.tieba.baidu.com/p/3350457130
http://c.tieba.baidu.com/p/3351123597
http://c.tieba.baidu.com/p/3353725953
http://c.tieba.baidu.com/p/3350284748
http://c.tieba.baidu.com/p/3350347255
http://c.tieba.baidu.com/p/3350360766
http://c.tieba.baidu.com/p/3350273858
http://c.tieba.baidu.com/p/3350453622
http://c.tieba.baidu.com/p/3353809347
http://c.tieba.baidu.com/p/3350526333
http://c.tieba.baidu.com/p/3350447381
http://c.tieba.baidu.com/p/3350342017
http://c.tieba.baidu.com/p/3350356366
http://c.tieba.baidu.com/p/3350523703
http://c.tieba.baidu.com/p/3350340312
http://c.tieba.baidu.com/p/3350365694
http://c.tieba.baidu.com/p/3350352960
http://c.tieba.baidu.com/p/3348670587
http://c.tieba.baidu.com/p/3348699252
http://c.tieba.baidu.com/p/3348680676
http://c.tieba.baidu.com/p/3348660343
http://c.tieba.baidu.com/p/3348698072
http://c.tieba.baidu.com/p/3348667855
http://c.tieba.baidu.com/p/3348657356
http://c.tieba.baidu.com/p/3348675117
http://c.tieba.baidu.com/p/3348695151
http://c.tieba.baidu.com/p/3348667213
http://c.tieba.baidu.com/p/3348674152
http://c.tieba.baidu.com/p/3353832562
http://c.tieba.baidu.com/p/3350783956
http://c.tieba.baidu.com/p/3350454490
http://c.tieba.baidu.com/p/3350361599
http://c.tieba.baidu.com/p/3348664638
http://c.tieba.baidu.com/p/3348669605
http://c.tieba.baidu.com/p/3348703872
http://c.tieba.baidu.com/p/3348681271
http://c.tieba.baidu.com/p/3348666102
http://c.tieba.baidu.com/p/3348705091
http://c.tieba.baidu.com/p/3348705091
http://c.tieba.baidu.com/p/3348673191
http://c.tieba.baidu.com/p/3348693503
http://c.tieba.baidu.com/p/3349157931
http://c.tieba.baidu.com/p/3349120813
http://c.tieba.baidu.com/p/3349060428
http://c.tieba.baidu.com/p/3349100871
http://c.tieba.baidu.com/p/3349078302
http://c.tieba.baidu.com/p/3348714829
http://c.tieba.baidu.com/p/3349181780
http://c.tieba.baidu.com/p/3349056950
http://c.tieba.baidu.com/p/3349075797
http://c.tieba.baidu.com/p/3349116319
http://c.tieba.baidu.com/p/3348711009
http://c.tieba.baidu.com/p/3348711009
http://c.tieba.baidu.com/p/3349107765
http://c.tieba.baidu.com/p/3349167134
http://c.tieba.baidu.com/p/3348708956
http://c.tieba.baidu.com/p/3349135247
http://c.tieba.baidu.com/p/3349192484
http://c.tieba.baidu.com/p/3349080966
http://c.tieba.baidu.com/p/3349106016
http://c.tieba.baidu.com/p/3349064335
http://c.tieba.baidu.com/p/3349163745
http://c.tieba.baidu.com/p/3349131798
http://c.tieba.baidu.com/p/3354070260
http://c.tieba.baidu.com/p/3354060763
http://c.tieba.baidu.com/p/3354147111
http://c.tieba.baidu.com/p/3354238270
http://c.tieba.baidu.com/p/3354083858
http://c.tieba.baidu.com/p/3354202763
http://c.tieba.baidu.com/p/3354182721
http://c.tieba.baidu.com/p/3354191318
http://c.tieba.baidu.com/p/3354133928
http://c.tieba.baidu.com/p/3354215444
http://c.tieba.baidu.com/p/3354071718
http://c.tieba.baidu.com/p/3354239543
http://c.tieba.baidu.com/p/3354149639
http://c.tieba.baidu.com/p/3354062282
http://c.tieba.baidu.com/p/3354111925
http://c.tieba.baidu.com/p/3354226726
http://c.tieba.baidu.com/p/3354195479
http://c.tieba.baidu.com/p/3354206526
http://c.tieba.baidu.com/p/3354138548
http://c.tieba.baidu.com/p/3354187491
http://c.tieba.baidu.com/p/3354112949
http://c.tieba.baidu.com/p/3354075326
http://c.tieba.baidu.com/p/3354065260
http://c.tieba.baidu.com/p/3354243829
http://c.tieba.baidu.com/p/3354204491
http://c.tieba.baidu.com/p/3354183940
http://c.tieba.baidu.com/p/3354135902
http://c.tieba.baidu.com/p/3354193677
http://c.tieba.baidu.com/p/3354218172
http://c.tieba.baidu.com/p/33541505054763448
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。