Commit b3edf85a authored by zhaochangbo's avatar zhaochangbo

add xss

parent 65c4c9be
......@@ -4,7 +4,10 @@ var async = require('async'),
xpath = require('xpath'),
dom = require('xmldom').DOMParser;
var helper = require('./helper');
var xss = require('xss')
const xssoptions = {
stripIgnoreTagBody: ['script']
}
/**
* 解析器
*/
......@@ -68,7 +71,7 @@ var _jquerySelectorParser = function ($, item) {
}
}
});
return data;
return xss(data, xssoptions);
};
// 上下文解析器
var _contextSelectorParser = function (body, item) {
......@@ -112,6 +115,9 @@ var _completionUrl = function (url, options) {
if (url.substr(0, 2) === './') {
url = url.substr(2);
}
if (url.substr(0, 3) === '../') {
url = url.substr(3);
}
var arrUrl = options.url.split('/');
arrUrl[arrUrl.length - 1] = url;
url = arrUrl.join('/');
......
{
"name": "z-almighty-parser-core",
"version": "1.0.6",
"version": "1.1.2",
"description": "crawler prser core",
"main": "index.js",
"scripts": {
......@@ -22,6 +22,7 @@
"opencc": "^1.0.5",
"request": "^2.81.0",
"xmldom": "^0.1.27",
"xpath": "0.0.24"
"xpath": "0.0.24",
"xss": "^0.3.3"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment