@wolfx/spider-utils

1.0.0 • Public • Published

易于使用的爬虫工具包,主要解决了 cheerio 爬虫的中文编码问题,并且封装更易于使用,目前私人使用中。 允许任何人以任何方式使用,但本人不承担代码使用后的风险。

方法

getHTML(url: string, options: {headers: Object, encoding: string, timeout: number})

将返回一个 Promise, 该 Promise 如果成功 resolve 将得到一个 $ (cheerio对象)。

stripScript(s: string)

用于过滤特殊字符

使用方式

const { getHTML, stripScript } = require("@wolfx/spider-utils");
getHTML(...).then($ => {
  console.log($("title").text());
});

Readme

Keywords

Package Sidebar

Install

npm i @wolfx/spider-utils

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • wolfx