public class Test |
{ |
@org .junit.Test |
public void getDatasByClass() |
{ |
Rule rule = new Rule( |
"http://www1.sxcredit.gov.cn/public/infocomquery.do?method=publicIndexQuery" , |
new String[] { "query.enterprisename" , "query.registationnumber" }, new String[] { "兴网" , "" }, |
"cont_right" , Rule.CLASS, Rule.POST); |
List<LinkTypeData> extracts = ExtractService.extract(rule); |
printf(extracts); |
} |
@org .junit.Test |
public void getDatasByCssQuery() |
{ |
Rule rule = new Rule( "http://www.11315.com/search" , |
new String[] { "name" }, new String[] { "兴网" }, |
"div.g-mn div.con-model" , Rule.SELECTION, Rule.GET); |
List<LinkTypeData> extracts = ExtractService.extract(rule); |
printf(extracts); |
} |
public void printf(List<LinkTypeData> datas) |
{ |
for (LinkTypeData data : datas) |
{ |
System.out.println(data.getLinkText()); |
System.out.println(data.getLinkHref()); |
System.out.println( "***********************************" ); |
} |
} |
} |
初级程序员
by: 菜鸟慢飞 发表于:2018-09-13 08:47:42 顶(0) | 踩(0) 回复
学习一下
回复评论