For a bit of scope, I have a scraping app that I am running on cloudfoundry. Due to the Contextify problem discussed here, I am unable to use jsdom to do this.
To get around this problem I started to replace jsdom with Cheerio, however I have now realised it does not fully support the Sizzle selectors I need to use to process the scraped data.
After a little research I'm beginning to think I've hit a brick wall - is there another way around this problem?
Thanks!
sorry for the delay on this. You can now successfully install JSDOM on Cloudfoundry, however, it seems some functionality is unavailable. Creating a browser window, to use jQuery for example, is not possible. However, you can create a jsdom document.
Given the following example;
var http = require('http');
var util = require('util');
var jsdom = require("jsdom");
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write("JSDom object;");
createDocAndQuery(res);
res.write("\nNumber of node.js releases = ");
getLinkCount(res);
}).listen(3000);
function createDocAndQuery(response) {
var doc = jsdom.jsdom("<html><body></body></html>", jsdom.level(1, "core"));
response.write(util.inspect(doc));
}
function getLinkCount(response) {
jsdom.env(
"http://nodejs.org/dist/",
["http://code.jquery.com/jquery.js"],
function (errors, window) {
response.end ("" + window.$("a").length)
}
);
}
The first part of this works on CloudFoundry.com, the second part fails however, when creating a window object.