All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.codecraft.webmagic.model.samples.DianpingFtlDataScanner Maven / Gradle / Ivy

The newest version!
package us.codecraft.webmagic.model.samples;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.model.AfterExtractor;
import us.codecraft.webmagic.model.OOSpider;
import us.codecraft.webmagic.model.annotation.ExtractBy;
import us.codecraft.webmagic.model.annotation.TargetUrl;

import java.util.List;

/**
 * @author [email protected] 
* Date: 13-8-13
* Time: 上午10:13
*/ @TargetUrl("http://*.alpha.dp/*") public class DianpingFtlDataScanner implements AfterExtractor { @ExtractBy(value = "(DP\\.data\\(\\{.*\\}\\));", type = ExtractBy.Type.Regex, notNull = true, multi = true) private List data; public static void main(String[] args) { OOSpider.create(Site.me().setSleepTime(0), DianpingFtlDataScanner.class) .thread(5).run(); } @Override public void afterProcess(Page page) { if (data.size() > 1) { System.err.println(page.getUrl()); } if (data.size() > 0 && data.get(0).length() > 100) { System.err.println(page.getUrl()); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy