Skip to content

Commit

Permalink
Added an option for allowing JSDOM to fetch and process external reso…
Browse files Browse the repository at this point in the history
…urces
  • Loading branch information
chriso committed Mar 18, 2011
1 parent e6863da commit 378e9f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/node.io/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion lib/node.io/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var default_options = {
args: [],
jsdom: false,
auto_retry: false,
ignore_code: false
ignore_code: false,
external_resources: false
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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>",
Expand Down

0 comments on commit 378e9f9

Please sign in to comment.