Package com.ontometrics.scraper.extraction

Examples of com.ontometrics.scraper.extraction.Link


      List<Link> foundLinks = new LinkExtractor().source(html().url(PagedListingTable.getUrl())).getLinks();
      ListIterator<Link> foundLinksIterator = foundLinks.listIterator();

      @Override
      public URL next() {
        Link currentLink = (Link) foundLinksIterator.next();
        log.debug("current iterating page = {}", currentLink.getHref());

        String CurrentURLStr = PagedListingFolder.getPath() + "/" + currentLink.getHref();
        URL currentURL = TestUtil.getFileAsURL(CurrentURLStr);

        return currentURL;
      }

      @Override
      public boolean hasNext() {

        try {
          Link nextLink = foundLinks.get(foundLinksIterator.nextIndex());
          log.debug("next page to iterate = {}", nextLink.getHref());
        } catch (Exception e) {
          log.debug("Page iterator can't peek next link");
        }

        return foundLinksIterator.hasNext();
View Full Code Here


    Source source = new Source(sourceToParse);
    source.fullSequentialParse();
    List<Link> links = new ArrayList<Link>();
    List<Element> as = source.getAllElements(HTMLElementName.A);
    for (Element linkElement : as) {
      links.add(new Link(linkElement.getTextExtractor().toString(), linkElement.getAttributeValue("href")));
    }
    return links;
  }
View Full Code Here

TOP

Related Classes of com.ontometrics.scraper.extraction.Link

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.