crawler-api
Some crawler api,which are briefness and powerful.
npm install
npm i crawler-api
API
- crawlerResponse
- get the response of a http request.
- crawlerFile
- get and save the response file of a http request.
- crawlerStaticWebpageAndJQuery
- get the webpage file of a http request, and use a jquery rule to get some info from the root element of the webpage.
type requestOptions =
| (request.UriOptions & request.CoreOptions)
| (request.UrlOptions & request.CoreOptions);
interface crawlerResponse {
(options: string | requestOptions, statusCodeCriticism?: boolean): Promise<
request.Response
>;
}
interface crawlerFile {
(options: string | requestOptions, filePathName: string): Promise<number>;
}
interface crawlerStaticWebpageAndJQuery {
(options: string | requestOptions, rule?: Rule): Promise<any>;
}
interface Rule {
_?: RuleItem;
[key: string]: RuleItem;
}
type RuleItem =
| "text"
| "value"
| "html"
| ["text" | "value" | "html"]
| ["data" | "attr" | "prop" | "css", string]
| ["findOne" | "find", string, Rule]
| Rule;