update package

pull/17/head
yihua.huang 12 years ago
parent cfb8990453
commit 21cae2ff2e

@ -9,7 +9,7 @@ import java.util.List;
/**
* <pre>
*Page
* Page
*
*
* {@link #getUrl()} Url
@ -19,6 +19,7 @@ import java.util.List;
* {@link #addTargetRequests(java.util.List)} {@link #addTargetRequest(String)}
*
* </pre>
*
* @author code4crafter@gmail.com <br>
*/
public class Page {
@ -36,9 +37,16 @@ public class Page {
public Page() {
}
public Page setSkip(boolean skip) {
resultItems.setSkip(skip);
return this;
}
/**
*
* @param key key
*
* @param key key
* @param field value
*/
public void putField(String key, Object field) {
@ -47,6 +55,7 @@ public class Page {
/**
* html
*
* @return html html
*/
public Selectable getHtml() {
@ -63,6 +72,7 @@ public class Page {
/**
*
*
* @param requests
*/
public void addTargetRequests(List<String> requests) {
@ -79,6 +89,7 @@ public class Page {
/**
*
*
* @param requestString
*/
public void addTargetRequest(String requestString) {
@ -93,6 +104,7 @@ public class Page {
/**
* 使
*
* @param request
*/
public void addTargetRequest(Request request) {
@ -103,6 +115,7 @@ public class Page {
/**
* Url
*
* @return url url
*/
public Selectable getUrl() {
@ -111,6 +124,7 @@ public class Page {
/**
* url
*
* @param url
*/
public void setUrl(Selectable url) {
@ -119,6 +133,7 @@ public class Page {
/**
*
*
* @return request
*/
public Request getRequest() {

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.Page;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import org.apache.commons.lang3.builder.ToStringBuilder;
import us.codecraft.webmagic.Task;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.selector.Selector;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.selector.Selector;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Request;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import org.apache.commons.lang3.StringUtils;
import us.codecraft.webmagic.Page;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.Task;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
@ -10,7 +10,7 @@ import java.util.List;
* @date: 13-8-1 <br>
* Time: 10:18 <br>
*/
@TargetUrl(value="http://my.oschina.net/flashsword/blog/*",sourceRegion = "//div[@class='BlogLinks']//a/@href")
@TargetUrl("http://my.oschina.net/flashsword/blog/*")
public class OschinaBlog implements AfterExtractor {
@ExtractBy("//title")
@ -27,6 +27,7 @@ public class OschinaBlog implements AfterExtractor {
System.out.println("title:\t"+title);
System.out.println("content:\t"+content);
System.out.println("tags:\t" + tags);
page.setSkip(true);
}
public static void main(String[] args) {

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo;
package us.codecraft.webmagic.model;
import org.junit.Ignore;
import org.junit.Test;

@ -1,4 +1,4 @@
package us.codecraft.webmagic.oo.samples;
package us.codecraft.webmagic.model.samples;
/**
* @author code4crafter@gmail.com <br>

@ -1,9 +1,9 @@
package us.codecraft.webmagic.oo.samples;
package us.codecraft.webmagic.model.samples;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.oo.ExtractBy;
import us.codecraft.webmagic.oo.OOSpider;
import us.codecraft.webmagic.oo.TargetUrl;
import us.codecraft.webmagic.model.ExtractBy;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.TargetUrl;
/**
* @author code4crafter@gmail.com <br>

@ -1,8 +1,8 @@
package us.codecraft.webmagic.oo.samples;
package us.codecraft.webmagic.model.samples;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.oo.*;
import us.codecraft.webmagic.model.*;
/**
* @author code4crafter@gmail.com <br>

@ -1,9 +1,9 @@
package us.codecraft.webmagic.oo.samples;
package us.codecraft.webmagic.model.samples;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.oo.ExtractBy;
import us.codecraft.webmagic.oo.OOSpider;
import us.codecraft.webmagic.oo.TargetUrl;
import us.codecraft.webmagic.model.ExtractBy;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.TargetUrl;
/**
* @author code4crafter@gmail.com <br>
Loading…
Cancel
Save