将整个html内容保存到指定文件
* 基本能实现网页抓取,不过要手动输入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://www.google.cn/");
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) {
e.printStackTrace();
}
}
}
4利用htmlparser提取网页纯文本的例子
http://c.tieba.baidu.com/p/3354370368
http://c.tieba.baidu.com/p/3354534701
http://c.tieba.baidu.com/p/3354547666
http://c.tieba.baidu.com/p/3354546842
http://c.tieba.baidu.com/p/3354527799
http://c.tieba.baidu.com/p/3354545064
http://c.tieba.baidu.com/p/3354537993
http://c.tieba.baidu.com/p/3354536371
http://c.tieba.baidu.com/p/3354566167
http://c.tieba.baidu.com/p/3354563874
http://c.tieba.baidu.com/p/3354559790
http://c.tieba.baidu.com/p/3354558402
http://c.tieba.baidu.com/p/3354557382
http://c.tieba.baidu.com/p/3354575677
http://c.tieba.baidu.com/p/3354574673
http://c.tieba.baidu.com/p/3354329758
http://c.tieba.baidu.com/p/3354324754
http://c.tieba.baidu.com/p/3354328957
http://c.tieba.baidu.com/p/3354358425
http://c.tieba.baidu.com/p/3354357165
http://c.tieba.baidu.com/p/3354354914
http://c.tieba.baidu.com/p/3354351963
http://c.tieba.baidu.com/p/3354339313
http://c.tieba.baidu.com/p/3354365196
http://c.tieba.baidu.com/p/3354516479
http://c.tieba.baidu.com/p/3354363645
http://c.tieba.baidu.com/p/3354511292
http://c.tieba.baidu.com/p/3354362725
http://c.tieba.baidu.com/p/3354493596
http://c.tieba.baidu.com/p/3354386728
http://c.tieba.baidu.com/p/3354247248
http://c.tieba.baidu.com/p/3354246081
http://c.tieba.baidu.com/p/3354244736
http://c.tieba.baidu.com/p/3354243829
http://c.tieba.baidu.com/p/3354255255
http://c.tieba.baidu.com/p/3354251795
http://c.tieba.baidu.com/p/3354251040
http://c.tieba.baidu.com/p/3354250060
http://c.tieba.baidu.com/p/3354289895
http://c.tieba.baidu.com/p/3354319537
http://c.tieba.baidu.com/p/3354259808
http://c.tieba.baidu.com/p/3354313871
http://c.tieba.baidu.com/p/3354309420
http://c.tieba.baidu.com/p/3354300027
http://c.tieba.baidu.com/p/3354297069
http://c.tieba.baidu.com/p/3354195479
http://c.tieba.baidu.com/p/3354206526
http://c.tieba.baidu.com/p/3354204491
http://c.tieba.baidu.com/p/3354202763
http://c.tieba.baidu.com/p/3354200335
http://c.tieba.baidu.com/p/3354196351
http://c.tieba.baidu.com/p/3354226726
http://c.tieba.baidu.com/p/3354218172
http://c.tieba.baidu.com/p/3354215444
http://c.tieba.baidu.com/p/3354213289
http://c.tieba.baidu.com/p/3354209995
http://c.tieba.baidu.com/p/3354239543
http://c.tieba.baidu.com/p/3354238270
http://c.tieba.baidu.com/p/3354236627
http://c.tieba.baidu.com/p/3354234679
http://c.tieba.baidu.com/p/3354135902
http://c.tieba.baidu.com/p/3354133928
http://c.tieba.baidu.com/p/3354150505
http://c.tieba.baidu.com/p/3354149639
http://c.tieba.baidu.com/p/3354147111
http://c.tieba.baidu.com/p/3354145982
http://c.tieba.baidu.com/p/3354183940
http://c.tieba.baidu.com/p/3354182721
http://c.tieba.baidu.com/p/3354181977
http://c.tieba.baidu.com/p/3354165876
http://c.tieba.baidu.com/p/3354193677
http://c.tieba.baidu.com/p/3354191318
http://c.tieba.baidu.com/p/3354190267
http://c.tieba.baidu.com/p/3354188371
http://c.tieba.baidu.com/p/3354187491
http://c.tieba.baidu.com/p/3354071718
http://c.tieba.baidu.com/p/3354068213
http://c.tieba.baidu.com/p/3354066474
http://c.tieba.baidu.com/p/3354065260
http://c.tieba.baidu.com/p/3354081216
http://c.tieba.baidu.com/p/3354076242
http://c.tieba.baidu.com/p/3354075326
http://c.tieba.baidu.com/p/3354070260
http://c.tieba.baidu.com/p/3354125762
http://c.tieba.baidu.com/p/3354116024
http://c.tieba.baidu.com/p/3354112949
http://c.tieba.baidu.com/p/3354111925
http://c.tieba.baidu.com/p/3354083858
http://c.tieba.baidu.com/p/3354143274
http://c.tieba.baidu.com/p/3354138548
http://c.tieba.baidu.com/p/3353995244
http://c.tieba.baidu.com/p/3353983804
http://c.tieba.baidu.com/p/3354033869
http://c.tieba.baidu.com/p/3354031872
http://c.tieba.baidu.com/p/3354030072
http://c.tieba.baidu.com/p/3354029118
http://c.tieba.baidu.com/p/3354017868
http://c.tieba.baidu.com/p/3354051512
http://c.tieba.baidu.com/p/3354047829
http://c.tieba.baidu.com/p/3354045861
http://c.tieba.baidu.com/p/3354045354
http://c.tieba.baidu.com/p/3354062282
http://c.tieba.baidu.com/p/3354060763
http://c.tieba.baidu.com/p/3354055056
http://c.tieba.baidu.com/p/3354054049
http://c.tieba.baidu.com/p/3353927623
http://c.tieba.baidu.com/p/3353940240
http://c.tieba.baidu.com/p/3353938328
http://c.tieba.baidu.com/p/3353936543
http://c.tieba.baidu.com/p/3353963286
http://c.tieba.baidu.com/p/3353962877
http://c.tieba.baidu.com/p/3353947445
http://c.tieba.baidu.com/p/3353945576
http://c.tieba.baidu.com/p/3353944480
http://c.tieba.baidu.com/p/3353973983
http://c.tieba.baidu.com/p/3353971215
http://c.tieba.baidu.com/p/3353969648
http://c.tieba.baidu.com/p/3353967089
http://c.tieba.baidu.com/p/3354012796
http://c.tieba.baidu.com/p/3353997102
http://c.tieba.baidu.com/p/3353890191
http://c.tieba.baidu.com/p/3353905961
http://c.tieba.baidu.com/p/3353899997
http://c.tieba.baidu.com/p/3353899117
http://c.tieba.baidu.com/p/3353897901
http://c.tieba.baidu.com/p/3353912601
http://c.tieba.baidu.com/p/3353911106
http://c.tieba.baidu.com/p/3353909641
http://c.tieba.baidu.com/p/3353908731
http://c.tieba.baidu.com/p/3353918532
http://c.tieba.baidu.com/p/3353916671
http://c.tieba.baidu.com/p/3353915532
http://c.tieba.baidu.com/p/3353932494
http://c.tieba.baidu.com/p/3353931175
http://c.tieba.baidu.com/p/3353929436
http://c.tieba.baidu.com/p/3348228581
http://c.tieba.baidu.com/p/3353836792
http://c.tieba.baidu.com/p/3348038141
http://c.tieba.baidu.com/p/3353721933
http://c.tieba.baidu.com/p/3353832562
http://c.tieba.baidu.com/p/3348036152
http://c.tieba.baidu.com/p/3353725953
http://c.tieba.baidu.com/p/3353809347
http://c.tieba.baidu.com/p/3348033983
http://c.tieba.baidu.com/p/3353634819
http://c.tieba.baidu.com/p/3348030767
http://c.tieba.baidu.com/p/3347963870
http://c.tieba.baidu.com/p/3353894141
http://c.tieba.baidu.com/p/3353882414
http://c.tieba.baidu.com/p/3353892081
http://c.tieba.baidu.com/p/3353871521
http://c.tieba.baidu.com/p/3353623846
http://c.tieba.baidu.com/p/3353627803
http://c.tieba.baidu.com/p/3353840487
http://c.tieba.baidu.com/p/3353632403
http://c.tieba.baidu.com/p/3351037171
http://c.tieba.baidu.com/p/3350783956
http://c.tieba.baidu.com/p/3350722055
http://c.tieba.baidu.com/p/3350526333
http://c.tieba.baidu.com/p/3350523703
http://c.tieba.baidu.com/p/3349746659
http://c.tieba.baidu.com/p/3349746193
http://c.tieba.baidu.com/p/3342851128
http://c.tieba.baidu.com/p/3343956876
http://c.tieba.baidu.com/p/3343982647
http://c.tieba.baidu.com/p/3350289085
http://c.tieba.baidu.com/p/3350356366
http://c.tieba.baidu.com/p/3350352960
http://c.tieba.baidu.com/p/3350349898
http://c.tieba.baidu.com/p/3350347255
http://c.tieba.baidu.com/p/3349744091
http://c.tieba.baidu.com/p/3350365694
http://c.tieba.baidu.com/p/3350363233
http://c.tieba.baidu.com/p/3350361599
http://c.tieba.baidu.com/p/3350360766
http://c.tieba.baidu.com/p/3350457130
http://c.tieba.baidu.com/p/3350456016
http://c.tieba.baidu.com/p/3350454490
http://c.tieba.baidu.com/p/3350453622
http://c.tieba.baidu.com/p/3350447381
http://c.tieba.baidu.com/p/3349662155
http://c.tieba.baidu.com/p/3349662058
http://c.tieba.baidu.com/p/3349662819
http://c.tieba.baidu.com/p/3349663978
http://c.tieba.baidu.com/p/3349662713
http://c.tieba.baidu.com/p/3349663893
http://c.tieba.baidu.com/p/3349663809
http://c.tieba.baidu.com/p/3349663090
http://c.tieba.baidu.com/p/3350273858
http://c.tieba.baidu.com/p/3350342017
http://c.tieba.baidu.com/p/3350270233
http://c.tieba.baidu.com/p/3350340312
http://c.tieba.baidu.com/p/3350264001
http://c.tieba.baidu.com/p/3350293571
http://c.tieba.baidu.com/p/3350284748
http://c.tieba.baidu.com/p/3349471195
http://c.tieba.baidu.com/p/3349454006
http://c.tieba.baidu.com/p/3349422346
http://c.tieba.baidu.com/p/3349497475
http://c.tieba.baidu.com/p/3349496514
http://c.tieba.baidu.com/p/3349492175
http://c.tieba.baidu.com/p/3349489949
http://c.tieba.baidu.com/p/3349486810
http://c.tieba.baidu.com/p/3349503220
http://c.tieba.baidu.com/p/3349500760
http://c.tieba.baidu.com/p/3349616615
http://c.tieba.baidu.com/p/3349605713
http://c.tieba.baidu.com/p/3348751148
http://c.tieba.baidu.com/p/3349662350
http://c.tieba.baidu.com/p/3349662259
http://c.tieba.baidu.com/p/3349313620
http://c.tieba.baidu.com/p/3349308773
http://c.tieba.baidu.com/p/3349307147
http://c.tieba.baidu.com/p/3349306060
http://c.tieba.baidu.com/p/3349320643
http://c.tieba.baidu.com/p/3349319835
http://c.tieba.baidu.com/p/3349318932
http://c.tieba.baidu.com/p/3349316873
http://c.tieba.baidu.com/p/3349415525
http://c.tieba.baidu.com/p/3349413068
http://c.tieba.baidu.com/p/3349412534
http://c.tieba.baidu.com/p/3349411578
http://c.tieba.baidu.com/p/3349420194
http://c.tieba.baidu.com/p/3349473345
http://c.tieba.baidu.com/p/3349472413
http://c.tieba.baidu.com/p/3349135247
http://c.tieba.baidu.com/p/3349181780
http://c.tieba.baidu.com/p/3349173901
http://c.tieba.baidu.com/p/3349169846
http://c.tieba.baidu.com/p/3349167134
http://c.tieba.baidu.com/p/3349236037
http://c.tieba.baidu.com/p/3349210172
http://c.tieba.baidu.com/p/3349201955
http://c.tieba.baidu.com/p/3349192484
http://c.tieba.baidu.com/p/3349249382
http://c.tieba.baidu.com/p/3349300376
http://c.tieba.baidu.com/p/3349298995
http://c.tieba.baidu.com/p/3349296986
http://c.tieba.baidu.com/p/3349292024
http://c.tieba.baidu.com/p/3349314788
http://c.tieba.baidu.com/p/3349053623
http://c.tieba.baidu.com/p/3349107765
http://c.tieba.baidu.com/p/3349087482
http://c.tieba.baidu.com/p/3349106016
http://c.tieba.baidu.com/p/3349100871
http://c.tieba.baidu.com/p/3349094782
http://c.tieba.baidu.com/p/3349089683
http://c.tieba.baidu.com/p/3349163745
http://c.tieba.baidu.com/p/3349131798
http://c.tieba.baidu.com/p/3349157931
http://c.tieba.baidu.com/p/3349120813
http://c.tieba.baidu.com/p/3349150179
http://c.tieba.baidu.com/p/3349116319
http://c.tieba.baidu.com/p/3349147580
http://c.tieba.baidu.com/p/3349114265
http://c.tieba.baidu.com/p/3348764515
http://c.tieba.baidu.com/p/3348766989
http://c.tieba.baidu.com/p/3348762437
http://c.tieba.baidu.com/p/3348759026
http://c.tieba.baidu.com/p/3348403611
http://c.tieba.baidu.com/p/3348250466
http://c.tieba.baidu.com/p/3347916738
http://c.tieba.baidu.com/p/3347895906
http://c.tieba.baidu.com/p/3344345935
http://c.tieba.baidu.com/p/3344036251
http://c.tieba.baidu.com/p/3343956876
http://c.tieba.baidu.com/p/3342851128
http://c.tieba.baidu.com/p/3350293571
http://c.tieba.baidu.com/p/3348699252
http://c.tieba.baidu.com/p/3348698072
http://c.tieba.baidu.com/p/3348711009
http://c.tieba.baidu.com/p/3348709986
http://c.tieba.baidu.com/p/3348708956
http://c.tieba.baidu.com/p/3348714829
http://c.tieba.baidu.com/p/3349064335
http://c.tieba.baidu.com/p/3349080966
http://c.tieba.baidu.com/p/3349078302
http://c.tieba.baidu.com/p/3349060428
http://c.tieba.baidu.com/p/3349075797
http://c.tieba.baidu.com/p/3349056950
http://c.tieba.baidu.com/p/3349072125
http://c.tieba.baidu.com/p/3349055074
http://c.tieba.baidu.com/p/3349067484
http://c.tieba.baidu.com/p/3348681271
http://c.tieba.baidu.com/p/3348660343
http://c.tieba.baidu.com/p/3348670587
http://c.tieba.baidu.com/p/3348680676
http://c.tieba.baidu.com/p/3348657356
http://c.tieba.baidu.com/p/3348667855
http://c.tieba.baidu.com/p/3348675117
http://c.tieba.baidu.com/p/3348674152
http://c.tieba.baidu.com/p/3348667213
http://c.tieba.baidu.com/p/3348673191
http://c.tieba.baidu.com/p/3348666102
http://c.tieba.baidu.com/p/3348695151
http://c.tieba.baidu.com/p/3348693503
http://c.tieba.baidu.com/p/3348705091
http://c.tieba.baidu.com/p/3348703872
http://c.tieba.baidu.com/p/3348161854
http://c.tieba.baidu.com/p/3348143962
http://c.tieba.baidu.com/p/3348135102
http://c.tieba.baidu.com/p/3348157377
http://c.tieba.baidu.com/p/3348153576
http://c.tieba.baidu.com/p/3348133544
http://c.tieba.baidu.com/p/3348233965
http://c.tieba.baidu.com/p/3348208415
http://c.tieba.baidu.com/p/3348228581
http://c.tieba.baidu.com/p/3348203130
http://c.tieba.baidu.com/p/3348224532
http://c.tieba.baidu.com/p/3348220537
http://c.tieba.baidu.com/p/3348216602
http://c.tieba.baidu.com/p/3348664638
http://c.tieba.baidu.com/p/3348669605
http://c.tieba.baidu.com/p/3348111849
http://c.tieba.baidu.com/p/3348052164
http://c.tieba.baidu.com/p/3348089011
http://c.tieba.baidu.com/p/3348033983
http://c.tieba.baidu.com/p/3348102860
http://c.tieba.baidu.com/p/3348048873
http://c.tieba.baidu.com/p/3348085278
http://c.tieba.baidu.com/p/3348030767
http://c.tieba.baidu.com/p/3348098446
http://c.tieba.baidu.com/p/3348041249
http://c.tieba.baidu.com/p/3348080770
http://c.tieba.baidu.com/p/3348149393
http://c.tieba.baidu.com/p/3348179673
http://c.tieba.baidu.com/p/3348146248
http://c.tieba.baidu.com/p/3348165622
http://c.tieba.baidu.com/p/3347655481
http://c.tieba.baidu.com/p/3319176104
http://c.tieba.baidu.com/p/3348039733
http://c.tieba.baidu.com/p/3348117819
http://c.tieba.baidu.com/p/3348073371
http://c.tieba.baidu.com/p/3347963870
http://c.tieba.baidu.com/p/3348095205
http://c.tieba.baidu.com/p/3348038141
http://c.tieba.baidu.com/p/3348115180
http://c.tieba.baidu.com/p/3348054425
http://c.tieba.baidu.com/p/3348091775
http://c.tieba.baidu.com/p/3348036152
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。