Permalink
Browse files

Added an option for allowing JSDOM to fetch and process external reso…

…urces
  • Loading branch information...
chriso committed Mar 18, 2011
1 parent e6863da commit 378e9f9cf93d645e658fa0b3af2ef8150b1fe50c
Showing with 6 additions and 4 deletions.
  1. +3 −2 lib/node.io/dom.js
  2. +2 −1 lib/node.io/job.js
  3. +1 −1 package.json
View
@@ -21,6 +21,7 @@ Job.prototype.$ = function (selector, context) {
}
var selected = soupselect(context, selector);
if (selected.length === 0) {
+ this.debug('\x1B[31mERR\x1B[0m No elements matching "' + selector + '"');
throw new Error("No elements matching '" + selector + "'");
} else if (selected.length === 1) {
selected = selected[0];
@@ -45,8 +46,8 @@ Job.prototype.parseHtml = function (data, callback, response) {
headers = response && response.headers ? response.headers : {};
if (this.options.jsdom) {
var features = {
- FetchExternalResources: false,
- ProcessExternalResources: false,
+ FetchExternalResources: this.options.external_resources,
+ ProcessExternalResources: this.options.external_resources,
QuerySelector: false
};
try {
View
@@ -31,7 +31,8 @@ var default_options = {
args: [],
jsdom: false,
auto_retry: false,
- ignore_code: false
+ ignore_code: false,
+ external_resources: false
};
/**
View
@@ -1,6 +1,6 @@
{ "name" : "node.io",
"description" : "A distributed data scraping and processing framework",
- "version" : "0.2.5-4",
+ "version" : "0.2.5-5",
"homepage" : "http://github.com/chriso/node.io",
"keywords" : ["data","mapreduce","map","reduce","scraping","html","parsing","parse","scrape","process","processing","data"],
"author" : "Chris O'Hara <cohara87@gmail.com>",

0 comments on commit 378e9f9

Please sign in to comment.