Exemplo n.º 1
0
    public void visit(Page page) {
      String url = page.getWebURL().getURL();

      // standard out contains a single line per URL, with the URL
      // followed by all the words found on the page
      //
      String text = page.getText().replaceAll("[^a-zA-Z]+", " ");
      System.out.println(url + "\t" + text);

      // standard err contains a line for each outgoing link from the
      // page we're crawling
      //
      for (WebURL link : page.getURLs()) {
        System.err.println(url + "\t" + link.getURL());
      }
    }