1.3.2 • Published 4 years ago

detection-worm-js v1.3.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

detection-worm-js

请求页面,并使用XPATH语法进行页面解析 (github)

安装

npm install -S detection-worm-js

引用

NodeJS

const dwj = require('detection-worm-js');
const Runner = dwj.WebLoader.Runner;
const xpath = dwj.XPath;

Runner("xxxxxx").then(res => { const xp = new xpath(res, true); const param = ; console.log(xp.selector(xpath解析字符串, param)) })

> ES6
``` typescript
import { XPath, WebLoader, ObjectType } from 'detection-worm-js';

WebLoader.Runner("xxxxxx").then(res => {
    const xp = new XPath(res, true);
    const param = [ ];
    console.log(xp.selector(`xpath解析字符串`, param))
})

方法使用

使用ThreadPool可以结合ThreadWorker类使用:

main.js:

const { ThreadPool } = require('detection-worm-js');

const workerPool = new ThreadPool().setWorkerOption(
  { filename: './ChildWorker.js' }
).start(5);

for (let i = 1; i <= 100; i++) {
  workerPool.run(i, (err, result) => {
    // 回调函数
  })
}

ChildWorker.js:

const { AbstractWorker } = require('detection-worm-js');

class Test extends AbstractWorker {

    // 重写`task`方法
    // @param param是入参
    task(param) {
    }
}

new Test();
1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1

4 years ago