java实现爬虫常用的第三方包:

  • httpclient,for http
  • jsoup,for dom
  • rhino,for js
  • jackson,for json

pom.xml摘录

    <dependencies>

        <!-- simulate web browser -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency> <!-- parse DOM -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency> <!-- jackson -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency> <!-- parse javascript -->
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.10</version>
</dependency> <!-- simulate client action -->
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.33</version>
</dependency> <!-- upgrade junit to junit4 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12<!-- default is v3.8.1 --></version>
<scope>test</scope>
</dependency> <!-- log -->
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<!-- <scope>test</scope> -->
</dependency> </dependencies>

启用log4j基本配置,在main方法中加入语句:

public static void main(String[] args) {

    //启用log4j基本配置
//不想去写配置文件,可以用Java基本配置
BasicConfigurator.configure();
//...
}

最新文章

  1. 鼠标右击.exe的程序出现闪退(桌面重启)怎么办
  2. XPath 实例
  3. poj3311 Hie with the Pie (状态压缩dp,旅行商)
  4. _jobdu_1001
  5. Redis Sets
  6. UCOS-消息队列(学习笔记)
  7. [九度OJ]1011.最大连续子序列
  8. 【hdu-2588】GCD(容斥定理+欧拉函数+GCD()原理)
  9. HDU 5348 MZL&#39;s endless loop
  10. 描述下@Component,@Repository,@Service,@Scope,@Autowired,@Inject,@Value标记的作用
  11. 使用DD 创建SWAP
  12. ubuntu18.04搭建nfs
  13. Exception异常转String【转】
  14. spring cloud配置中心属性加密处理
  15. [Guitar self-practising] 【吉他练习王-节奏练习】曲目1 基本扫弦节奏练习
  16. hdu1540 Tunnel Warfare 线段树/树状数组
  17. centos 磁盘清理 /dev/vda1系统盘满了
  18. vue学习视频网址(各种前端视频 网址)
  19. intelliJ 打包jar的多种方式
  20. Java使用String类格式化当前日期

热门文章

  1. PythonStudy——装饰器 Decorator
  2. Python error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)解决方案
  3. Linux ①
  4. rcc时钟
  5. Centos7下安装pptp客户端
  6. 一般处理程序获取get,post数据
  7. 接口自动化 基于python+Testlink+Jenkins实现的接口自动化测试框架
  8. VS2012统计代码量
  9. Java 锁的学习
  10. python with as的用法