本文整理汇总了Java中us.codecraft.webmagic.pipeline.ConsolePipeline类的典型用法代码示例。如果您正苦于以下问题:Java ConsolePipeline类的具体用法?Java ConsolePipeline怎么用?Java ConsolePipeline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsolePipeline类属于us.codecraft.webmagic.pipeline包,在下文中一共展示了ConsolePipeline类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initComponent
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
protected void initComponent() {
if (downloader == null) {
this.downloader = new HttpClientDownloader();
}
if (pipelines.isEmpty()) {
pipelines.add(new ConsolePipeline());
}
downloader.setThread(threadNum);
if (threadPool == null || threadPool.isShutdown()) {
if (executorService != null && !executorService.isShutdown()) {
threadPool = new CountableThreadPool(threadNum, executorService);
} else {
threadPool = new CountableThreadPool(threadNum);
}
}
if (startRequests != null) {
for (Request request : startRequests) {
addRequest(request);
}
startRequests.clear();
}
startTime = new Date();
}
开发者ID:hexiaohong-code,项目名称:LoginCrawler,代码行数:24,代码来源:SpiderLogin.java
示例2: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
init();
String key = null;
key = readKey(key);
System.out.println("The demo started and will last 20 seconds...");
//Start spider
OOSpider.create(Site.me(), clazzMap.get(key))
.addUrl(urlMap.get(key))
.addPipeline(new MultiPagePipeline())
.addPipeline(new ConsolePipeline())
.runAsync();
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("The demo stopped!");
System.out.println("To more usage, try to customize your own Spider!");
System.exit(0);
}
开发者ID:mikeqian,项目名称:house,代码行数:22,代码来源:QuickStarter.java
示例3: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
init();
String key = null;
key = readKey(key);
System.out.println("The demo started and will last 20 seconds...");
//Start spider
OOSpider.create(Site.me().addStartUrl(urlMap.get(key)), clazzMap.get(key)).pipeline(new PagedPipeline()).pipeline(new ConsolePipeline()).runAsync();
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("The demo stopped!");
System.out.println("To more usage, try to customize your own Spider!");
System.exit(0);
}
开发者ID:yuany,项目名称:en-webmagic,代码行数:18,代码来源:QuickStarter.java
示例4: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
init();
String key = null;
key = readKey(key);
System.out.println("The demo started and will last 20 seconds...");
//Start spider
OOSpider.create(Site.me(), clazzMap.get(key)).addUrl(urlMap.get(key)).addPipeline(new MultiPagePipeline()).addPipeline(new ConsolePipeline()).runAsync();
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("The demo stopped!");
System.out.println("To more usage, try to customize your own Spider!");
System.exit(0);
}
开发者ID:code4craft,项目名称:webmagic,代码行数:18,代码来源:QuickStarter.java
示例5: start
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public ConcurrentHashMap<byte[], byte[]> start(List<String> pageNumberList, String tiebaName) {
isAddTarget=false;
map.clear();
this.tiebaName=tiebaName;
this.pageNumberList = pageNumberList;
this.url = tieBaConfiguration.getTiebaContentPageUrl();
Spider.create(this).addUrl(url).addPipeline(new ConsolePipeline())
// 开启5个线程抓取
.thread(30)
// 启动爬虫
.run();
return map;
}
开发者ID:ggj2010,项目名称:javabase,代码行数:14,代码来源:ContentImageProcessor.java
示例6: start
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public ConcurrentHashMap<String, TopBean> start(String name) {
isAddTarget=false;
map.clear();
tiebaName = name;
tiebaUrl = tieba.getTiebaTopUrl() + name;
Spider.create(this).addUrl(tiebaUrl).addPipeline(new ConsolePipeline())
// 开启5个线程抓取
// .thread(200)
//服务器上面线程数不能开启多 防止链接异常
.thread(2)
// 启动爬虫
.run();
return map;
}
开发者ID:ggj2010,项目名称:javabase,代码行数:15,代码来源:TopProcessor.java
示例7: start
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public void start(String tiebaName) {
isAddTarget=false;
pageNumberList.clear();
this.tiebaName=tiebaName;
tiebaUrl = tieBaConfiguration.getTiebaContentUrl() + tiebaName;
endNum=Integer.parseInt(tieBaConfiguration.getTiebaContentPageEndNum());
Spider.create(this).addUrl(tiebaUrl).addPipeline(new ConsolePipeline())
// 开启5个线程抓取
.thread(2)
// 启动爬虫
.run();
if(pageNumberList.size()>0) {
redisTemplate.convertAndSend(tieBaConfiguration.getTiebaContentIdTopic(), JSONObject.toJSONString(pageNumberList));
}
}
开发者ID:ggj2010,项目名称:javabase,代码行数:16,代码来源:ContentIdProcessor.java
示例8: action
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public void action() {
Spider.create(new DoubanHouseProcessor())
.addUrl(HouseSource.DOUBAN)
.addPipeline(new ConsolePipeline())
.run();
Spider.create(new TongChengHouseProcessor())
.addUrl(HouseSource.COM_58)
.addPipeline(new ConsolePipeline())
.run();
}
开发者ID:xyalan,项目名称:findhouse,代码行数:12,代码来源:SpiderStarter.java
示例9: checkComponent
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
protected void checkComponent() {
if (downloader == null) {
this.downloader = new HttpClientDownloader();
}
if (pipelines.isEmpty()) {
pipelines.add(new ConsolePipeline());
}
downloader.setThread(threadNum);
}
开发者ID:yuany,项目名称:en-webmagic,代码行数:10,代码来源:Spider.java
示例10: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
Spider.create(new VogueBrandSpider()).addUrl("http://brand.vogue.com.cn")
.addPipeline(new ConsolePipeline()).run();
}
开发者ID:CieloSun,项目名称:FashionSpider,代码行数:5,代码来源:VogueBrandSpider.java
示例11: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
OOSpider.create(Site.me(), News163.class).addUrl("http://news.163.com/13/0802/05/958I1E330001124J_2.html")
.scheduler(new RedisScheduler("localhost")).addPipeline(new MultiPagePipeline()).addPipeline(new ConsolePipeline()).run();
}
开发者ID:mikeqian,项目名称:house,代码行数:5,代码来源:News163.java
示例12: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
OOSpider.create(Site.me().addStartUrl("http://news.163.com/13/0802/05/958I1E330001124J_2.html"), News163.class)
.scheduler(new RedisScheduler("localhost")).clearPipeline().pipeline(new PagedPipeline()).pipeline(new ConsolePipeline()).run();
}
开发者ID:yuany,项目名称:en-webmagic,代码行数:5,代码来源:News163.java
示例13: main
import us.codecraft.webmagic.pipeline.ConsolePipeline; //导入依赖的package包/类
public static void main(String[] args) {
Spider.create(new OschinaBlogPageProcesser()).pipeline(new ConsolePipeline()).run();
}
开发者ID:yuany,项目名称:en-webmagic,代码行数:4,代码来源:OschinaBlogPageProcesser.java
注:本文中的us.codecraft.webmagic.pipeline.ConsolePipeline类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论