const casper = require('casper').create();
const fs = require('fs');

const selectorKanttiini = ".siteorigin-widget-tinymce.textwidget";

casper.start('http://www.smarteat.fi/menu-pitskun-kanttiini/');

casper.waitForSelector(selectorKanttiini, function() {
  const html = this.getHTML(selectorKanttiini, true);
  fs.write("./crawled/kanttiini.html", html, 'w');
});

casper.run();
@@ -1,13 +1,11 @@
-const
+var
  casper 
@@ -34,21 +34,19 @@
 eate();%0A
-const
+var
  fs = re
@@ -63,126 +63,804 @@
 );%0A%0A
-const selectorKanttiini = %22.siteorigin-widget-tinymce.textwidget%22;%0A%0Acasper.start('http://www.smarteat.fi/menu-pitskun-
+var urls = %7B%0A  %22kanttiini%22: %22http://www.smarteat.fi/menu-pitskun-kanttiini/%22,%0A  %22variantti%22: %22https://www.taitotalo.com/fi/ravintolat/lounaslistat/variantti-viikon-lounaslista/%22,%0A  // %22factory%22: %22http://www.smarteat.fi/menu-pitskun-kanttiini/%22,%0A  %22blancco%22: %22http://www.ravintolablancco.com/ravintolat/pitajanmaki/%22,%0A%7D%0A%0Avar date = new Date();%0Avar yyyy = date.getYear();%0Avar mm = date.getMonth().toString();;%0Avar dd = date.getDay().toString();%0A%0Aif (mm.length %3C 1) %7B%0A  mm = %220%22 +  mm;%0A%7D%0A%0Aif (dd.length %3C 1) %7B%0A  dd = %220%22 +  dd;%0A%7D%0A%0Avar tasteParams = yyyy + %22/%22 + mm + %22/%22 + dd;%0Aurls.taste = %22http://www.sodexo.fi/ruokalistat/output/weekly_html/6095/%22+tasteParams+%22/fi%22;%0A%0Aconst selectors = %7B%0A  kanttiini: %22.siteorigin-widget-tinymce.textwidget%22,%0A  variantti: %22.lunch-list%22,%0A%7D%0A%0A// casper.thenOpen(urls.
 kant
@@ -868,14 +868,14 @@
 iini
-/'
 );%0A
-%0A
+// 
 casp
@@ -893,33 +893,35 @@
 elector(selector
-K
+s.k
 anttiini, functi
@@ -927,16 +927,19 @@
 ion() %7B%0A
+// 
   const 
@@ -970,9 +970,11 @@
 ctor
-K
+s.k
 antt
@@ -986,16 +986,19 @@
  true);%0A
+// 
   fs.wri
@@ -1040,16 +1040,218 @@
 , 'w');%0A
+// %7D);%0A%0Acasper.start(urls.variantti);%0Acasper.waitForSelector(selectors.variantti, function() %7B%0A  const html = this.getHTML(selectors.variantti, true);%0A  fs.write(%22./crawled/variantti.html%22, html, 'w');%0A
 %7D);%0A%0Acas

Add variantti