[Java] 爬虫 →→→→→进入此内容的聊天室

来自 , 2019-05-25, 写在 Java, 查看 110 次.
URL http://www.code666.cn/view/e8d92f99
  1. public class Test
  2. {
  3.         @org.junit.Test
  4.         public void getDatasByClass()
  5.         {
  6.                 Rule rule = new Rule(
  7.                                 "http://www1.sxcredit.gov.cn/public/infocomquery.do?method=publicIndexQuery",
  8.                 new String[] { "query.enterprisename","query.registationnumber" }, new String[] { "兴网","" },
  9.                                 "cont_right", Rule.CLASS, Rule.POST);
  10.                 List<LinkTypeData> extracts = ExtractService.extract(rule);
  11.                 printf(extracts);
  12.         }
  13.  
  14.         @org.junit.Test
  15.         public void getDatasByCssQuery()
  16.         {
  17.                 Rule rule = new Rule("http://www.11315.com/search",
  18.                                 new String[] { "name" }, new String[] { "兴网" },
  19.                                 "div.g-mn div.con-model", Rule.SELECTION, Rule.GET);
  20.                 List<LinkTypeData> extracts = ExtractService.extract(rule);
  21.                 printf(extracts);
  22.         }
  23.  
  24.         public void printf(List<LinkTypeData> datas)
  25.         {
  26.                 for (LinkTypeData data : datas)
  27.                 {
  28.                         System.out.println(data.getLinkText());
  29.                         System.out.println(data.getLinkHref());
  30.                         System.out.println("***********************************");
  31.                 }
  32.  
  33.         }
  34. }
  35.  

回复 "爬虫"

这儿你可以回复上面这条便签

captcha