爬虫的基础邹形
来源:互联网 发布:大数据安全管理办法 编辑:程序博客网 时间:2024/04/26 08:05
三个方法/** * 网络爬虫基础邹形 * @author Administrator * */public class urlreptile { public static void main(String[] args) { /*try {//输入流 URL url =new URL("https://www.baidu.com"); InputStream input=url.openStream(); byte [] flush =new byte[1024]; int len=0; while(-1!=(len=input.read(flush))){ System.out.println(new String(flush,0,len)); } input.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }*/ /*try {//转换流InputStreamReader里面可以输入流和字符转换参数 URL url = new URL("https://www.baidu.com"); BufferedReader bs = new BufferedReader(new InputStreamReader(url.openStream(),"utf-8")); String msg=null; while(null!=(msg=bs.readLine())){ System.out.println(msg); } } catch (MalformedURLException e) { System.out.println("域名解析异常"); e.printStackTrace(); } catch (IOException e) { System.out.println("IO流异常"); e.printStackTrace(); }*/ try {//转换流OutputStreamWriter和InputStreamReader里面可以有字符转换 URL url =new URL("https://www.baidu.com"); BufferedReader bs = new BufferedReader(new InputStreamReader(url.openStream(),"utf-8")); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("baidu.html"),"utf-8")); String msg=null; while(null!=(msg=bs.readLine())){ bw.append(msg); bw.newLine(); } bw.flush(); bw.close(); bs.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }}
0 0
- 爬虫的基础邹形
- python的爬虫基础介绍
- 最基础的爬虫代码
- python爬虫-->爬虫基础
- 爬虫实战1—爬虫的基础技术
- 爬虫基础
- 爬虫基础
- 爬虫基础。
- 爬虫基础
- 爬虫基础
- 爬虫基础
- 关于Python做爬虫的一点基础
- 转载自火车头,爬虫的基础
- 爬虫基础-- 正则基础
- Python的Urllib库的使用(爬虫基础)
- [爬虫] 爬虫的实现
- 网络爬虫(三)------宽度优先爬虫(一个的基础,简单但是很重要哦)
- 搜狗词库爬虫(2):基础爬虫框架的运行流程
- 在天涯、猫眼关于读经和汉服的论战
- hadoop权威指南读书总结
- hihocoder 1238 实时查询树的所有节点对距离和
- 太监式爱国 —— 忠君爱国主义(转载)
- 机器学习算法之六:5分钟上手Logistic Regression
- 爬虫的基础邹形
- 学习笔记之——自定义Dialog仿ios弹出底部菜单
- 单击AutoCompleteTextView后自动提示,无需输入字符,提示信息通过SQLite查询获得
- 多尔衮是清初开国头号美男
- java.lang.IllegalStateException: Fragment already active,Fragment.setArguments()问题
- SystemBarTintManager.java
- A004-数据对齐的原因
- iOS - 工程引入doubango (idoubs编译)
- 线性插值和双线性插值