Package barrysoft.web

Examples of barrysoft.web.ExtractionJob


    outr.setGroupName("subtitle link", 0);
    //outr.addParam(new ParserRuleParam("episode", "How I Met Your Mother 2x06"));
   
    episode.getParser().addRule(outr);
   
    ExtractionJob job = new ExtractionJob("Get ITSA subtitle link");
   
    ExtractionStep estep = new ExtractionStep("Get season's page", search, season);
    estep.connect("season link", ExtractionStep.URL_BINDING);
    job.addStep(estep);
   
    estep = new ExtractionStep("Get subtitle's page", season, episode);
    estep.connect("episodes link", ExtractionStep.URL_BINDING);
    job.addStep(estep);
   
    try {
      job.execute();
    } catch (IllegalStateException e) {
      fail(e.getMessage());
    } catch (MalformedURLException e) {
      fail(e.getMessage());
    } catch (IOException e) {
      fail(e.getMessage());
    }
   
    String[] link;
    try {
      link = episode.getParser().getRule(0).getResults("subtitle link");
      assertEquals(1, link.length);
      System.out.println(link[0]);
    } catch (IndexOutOfBoundsException e) {
      fail(e.getMessage());
    } catch (NoSuchElementException e) {
      fail(e.getMessage());
    }
   
    System.out.println(job.getXML(0));
  }
View Full Code Here

TOP

Related Classes of barrysoft.web.ExtractionJob

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.