- FileOutputStream fos = new FileOutputStream(new File(LOG_FILE));
- PrintStream os = new PrintStream(fos);
-
- try {
- ConfigurationParser parser = new ConfigurationParser(os);
- InputStream configFile = new FileInputStream(new File(
- configFileName));
- Configuration config = parser.parse(configFile);
-
- HttpClient client = new HttpClient();
- // client.getHostConfiguration().setProxy("localhost", 3128);
-
- Crawler crawler = new CrawlerImpl(client, config);
-
- System.out.println("Retrieving: " + starturl);
- Page page = crawler.getPage(starturl);
- showPage(page);
- page = page.getAction("channels-favorites").execute();
- recordInterestingShows(page);
- showPage(page);
- page = page.getAction("Nederland 1").execute();
- showPage(page);
- page = page.getAction("right-now").execute();
- showPage(page);
- page = page.getAction("Het elfde uur").execute();
- showPage(page);
- } finally {
- os.flush();
- os.close();
- System.out.println("Output written on '" + LOG_FILE + "'");
- }
+ ConfigurationParser parser = new ConfigurationParser();
+ InputStream configFile = new FileInputStream(new File(configFileName));
+ Configuration config = parser.parse(configFile);
+
+ HttpClient client = new HttpClient();
+ // client.getHostConfiguration().setProxy("localhost", 3128);
+
+ Crawler crawler = new CrawlerImpl(client, config);
+
+ System.out.println("Retrieving: " + starturl);
+ Page page = crawler.getPage(starturl);
+ showPage(page);
+ page = page.getAction("channels-favorites").execute();
+ recordInterestingShows(page);
+ showPage(page);
+ page = page.getAction("Nederland 1").execute();
+ showPage(page);
+ page = page.getAction("right-now").execute();
+ showPage(page);
+ page = page.getAction("Het elfde uur").execute();
+ showPage(page);