Commit 7038c00a authored by yihua.huang's avatar yihua.huang

reformat

parent 6252042e
...@@ -22,27 +22,27 @@ ...@@ -22,27 +22,27 @@
Add dependencies to your pom.xml: Add dependencies to your pom.xml:
```xml ```xml
<dependency> <dependency>
<groupId>us.codecraft</groupId> <groupId>us.codecraft</groupId>
<artifactId>webmagic-core</artifactId> <artifactId>webmagic-core</artifactId>
<version>0.4.3</version> <version>0.4.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>us.codecraft</groupId> <groupId>us.codecraft</groupId>
<artifactId>webmagic-extension</artifactId> <artifactId>webmagic-extension</artifactId>
<version>0.4.3</version> <version>0.4.3</version>
</dependency> </dependency>
``` ```
WebMagic use slf4j with slf4j-log4j12 implementation. If you customized your slf4j implementation, please exclude slf4j-log4j12. WebMagic use slf4j with slf4j-log4j12 implementation. If you customized your slf4j implementation, please exclude slf4j-log4j12.
```xml ```xml
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
``` ```
...@@ -53,7 +53,7 @@ WebMagic use slf4j with slf4j-log4j12 implementation. If you customized your slf ...@@ -53,7 +53,7 @@ WebMagic use slf4j with slf4j-log4j12 implementation. If you customized your slf
Write a class implements PageProcessor: Write a class implements PageProcessor:
```java ```java
public class OschinaBlogPageProcesser implements PageProcessor { public class OschinaBlogPageProcesser implements PageProcessor {
private Site site = Site.me().setDomain("my.oschina.net"); private Site site = Site.me().setDomain("my.oschina.net");
...@@ -76,7 +76,7 @@ Write a class implements PageProcessor: ...@@ -76,7 +76,7 @@ Write a class implements PageProcessor:
Spider.create(new OschinaBlogPageProcesser()).addUrl("http://my.oschina.net/flashsword/blog") Spider.create(new OschinaBlogPageProcesser()).addUrl("http://my.oschina.net/flashsword/blog")
.addPipeline(new ConsolePipeline()).run(); .addPipeline(new ConsolePipeline()).run();
} }
} }
``` ```
* `page.addTargetRequests(links)` * `page.addTargetRequests(links)`
...@@ -86,8 +86,8 @@ Write a class implements PageProcessor: ...@@ -86,8 +86,8 @@ Write a class implements PageProcessor:
You can also use annotation way: You can also use annotation way:
```java ```java
@TargetUrl("http://my.oschina.net/flashsword/blog/\\d+") @TargetUrl("http://my.oschina.net/flashsword/blog/\\d+")
public class OschinaBlog { public class OschinaBlog {
@ExtractBy("//title") @ExtractBy("//title")
private String title; private String title;
...@@ -103,7 +103,7 @@ You can also use annotation way: ...@@ -103,7 +103,7 @@ You can also use annotation way:
Site.me(), Site.me(),
new ConsolePageModelPipeline(), OschinaBlog.class).addUrl("http://my.oschina.net/flashsword/blog").run(); new ConsolePageModelPipeline(), OschinaBlog.class).addUrl("http://my.oschina.net/flashsword/blog").run();
} }
} }
``` ```
### Docs and samples: ### Docs and samples:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment