@hanivanrizky/nestjs-html-parser
Version:
A powerful NestJS HTML parsing service with XPath and CSS selector support, proxy configuration, random user agents, and rich response metadata including headers and status codes
62 lines • 2.37 kB
JavaScript
;
/**
* @fileoverview NestJS HTML Parser Package
*
* A powerful NestJS package for parsing HTML content with comprehensive features:
*
* ## Features
* - **XPath & CSS Selectors**: Extract data using XPath expressions or CSS selectors
* - **Proxy Support**: Configure HTTP, HTTPS, SOCKS4, and SOCKS5 proxies with authentication
* - **Random User Agents**: Rotate user agents to avoid detection
* - **Rich Metadata**: Get response headers, status codes, and more
* - **Retry Logic**: Configurable retry attempts with delays
* - **Verbose Logging**: Detailed debugging information
* - **Type Safety**: Full TypeScript support with comprehensive types
*
* ## Quick Start
* ```typescript
* import { HtmlParserModule, HtmlParserService } from '@hanivanrizky/nestjs-html-parser';
*
* // In your module
* @Module({
* imports: [HtmlParserModule],
* })
* export class AppModule {}
*
* // In your service
* @Injectable()
* export class MyService {
* constructor(private htmlParser: HtmlParserService) {}
*
* async getData() {
* const response = await this.htmlParser.fetchHtml('https://example.com');
* const title = this.htmlParser.extractSingle(response.data, '//title/text()');
* return title;
* }
* }
* ```
*
* @author Hanivan Rizky Sobari <hanivan20@gmail.com>
* @license MIT
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./app.module"), exports);
__exportStar(require("./examples"), exports);
__exportStar(require("./html-parser.module"), exports);
__exportStar(require("./html-parser.service"), exports);
__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map