コード例 #1
0
 @Override
 public void parsePages(ArrayList<?> tableList, Map.Entry<String, String> entry) {
   int type = 2;
   String[] words = entry.getValue().split(";");
   String key = entry.getKey().split(";")[0];
   String website = "全景社区";
   for (Element ele : (ArrayList<Element>) tableList) {
     String title = ele.select("h3.title").select("a").text();
     String time = Subutils.getTime(ele.select("p.meta").last().text());
     String summary = ele.select("p.content").text();
     String url = ele.select("h3.title").select("a").attr("href");
     String content = Page.getContent(url, "div.pcb", "utf-8");
     ArrayList<Integer> FNum = new ArrayList<Integer>();
     if (Transmition.contentFilter(words, content, key, FNum)
         && Transmition.timeFilter(time, this.spyHistory, title)) {
       spyHistory.add(title);
       Transmition.showDebug(type, title, content, url, time, summary, website, FNum.get(0));
       // 调接口~~~~~
       Article article =
           Transmition.getArticle(
               type, title, content, url, time, summary, website, key, FNum.get(0));
       Transmition.transmit(article);
     }
   }
 }
コード例 #2
0
 @Override
 public void parsePages(ArrayList<?> tableList, Map.Entry<String, String> entry) {
   String website = "中国企业新闻";
   int type = 4;
   String[] words = entry.getValue().split(";");
   String key = entry.getKey().split(";")[0];
   for (Element ele : (ArrayList<Element>) tableList) {
     String title = ele.select("li.news_title").select("a").text();
     String time = FormatTime.getTime(ele.select("li.news_other").text(), "\\d{4}-\\d{2}-\\d{2}");
     String summary = ele.select("li.news_content").text();
     String url = ele.select("li.news_title").select("a").attr("href");
     String content = Page.getAllHtmlContent(url);
     ArrayList<Integer> FNum = new ArrayList<Integer>();
     if (Transmition.contentFilter(words, content, key, FNum)
         && Transmition.timeFilter(time, this.spyHistory, title)) {
       spyHistory.add(title);
       Transmition.showDebug(type, title, content, url, time, summary, website, FNum.get(0));
       // 调接口~~~~~
       Article article =
           Transmition.getArticle(
               type, title, content, url, time, summary, website, key, FNum.get(0));
       Transmition.transmit(article);
     }
   }
 }