From 6d032ff34d050b56b6601ca6cda9fcc78c06c56b Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 14 Jan 2017 00:15:21 +0300 Subject: [PATCH] phantom --- phantom.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 phantom.js diff --git a/phantom.js b/phantom.js new file mode 100644 index 0000000..1db9015 --- /dev/null +++ b/phantom.js @@ -0,0 +1,26 @@ +var url = "http://localhost:3000/"; +var page = require('webpage').create(); + +page.open(url, function(status) { + if (status == 'fail') + phantom.exit(); + + var intervalTime = 1; + setInterval(function() { + var ready = page.evaluate(function () { + if(typeof window.isReady !== 'undefined') + { + return window.isReady(); + } + return false; + }); + if (ready) { + var out = page.content; + out = out.replace(/]+>(.|\n|\r)*?<\/script\s*>/ig, ''); + out = out.replace('', ''); + out = out.replace('', ''); + console.log(out) + phantom.exit(); + } + }, intervalTime++); +}); \ No newline at end of file