@nhinguyen122026/antibot-scraper-client
v1.0.2
Published
High-performance Node.js & TypeScript client for Anti-Bot & TLS Fingerprint Edge Scraper API for AI Agents, LLMs, and RAG pipelines.
Maintainers
Readme
@nhinguyen122026/antibot-scraper-client
High-performance Node.js & TypeScript client for the Anti-Bot & TLS Fingerprint Edge Scraper API. Engineered for AI Agents, LLM context retrieval, and modern RAG pipelines.
✨ Features
- 🛡️ Authentic TLS/JA3/JA4 Fingerprint Impersonation: Bypasses Cloudflare, Akamai, and perimeter bot detection by spoofing full browser TLS handshakes.
- 🤖 LLM & Agent Native: Extracts clean, dense Markdown ready to be fed directly into GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5/2.0 context windows.
- ⚡ Zero External Dependencies: Powered by native
fetchwith AbortController timeout handling. Compatible with Node 18+, Bun, Deno, and Cloudflare Workers. - 🔄 Autonomous Challenge Retries: Automated fallback retry mechanism with browser profile rotation upon detecting Cloudflare Turnstile or WAF challenges.
- 📘 Full TypeScript Definitions: First-class type safety with detailed JSDoc documentation.
📦 Installation
npm install @nhinguyen122026/antibot-scraper-client
# or
pnpm add @nhinguyen122026/antibot-scraper-client
# or
yarn add @nhinguyen122026/antibot-scraper-client🚀 Quick Start
1. Basic Markdown Extraction
import { AntiBotScraperClient } from '@nhinguyen122026/antibot-scraper-client';
const scraper = new AntiBotScraperClient({
apiKey: process.env.RAPIDAPI_KEY // Optional if using free tier
});
async function main() {
const result = await scraper.scrape({
url: 'https://news.ycombinator.com',
output_format: 'markdown',
profile_id: 'chrome124_win'
});
console.log(`Scraped ${result.content_length} bytes in ${result.duration_ms}ms`);
console.log(`TLS Fingerprint: ${result.tls_fingerprint}`);
console.log(result.content);
}
main();2. Streamlined Content Shortcut
const { AntiBotScraperClient } = require('@nhinguyen122026/antibot-scraper-client');
const scraper = new AntiBotScraperClient();
async function run() {
// Returns raw markdown string directly
const markdown = await scraper.scrapeContent('https://en.wikipedia.org/wiki/Artificial_intelligence');
console.log(markdown.slice(0, 500));
}
run();🤖 RAG & AI Agent Integration
LangChain / LlamaIndex Document Loader Pattern
import { AntiBotScraperClient } from '@nhinguyen122026/antibot-scraper-client';
const scraper = new AntiBotScraperClient();
async function loadWebDocumentForRAG(url: string) {
const response = await scraper.scrape({
url,
output_format: 'markdown',
timeout: 25
});
return {
pageContent: response.content,
metadata: {
source: response.url,
finalUrl: response.final_url,
retrievedAt: new Date().toISOString(),
tlsProfile: response.profile_used
}
};
}⚙️ Configuration & Options
AntiBotScraperClient(options)
apiKey(string, optional): Your RapidAPI subscription key.baseUrl(string, optional): Custom endpoint override.defaultTimeout(number, default: 30000): HTTP client timeout in milliseconds.
scraper.scrape(options)
| Option | Type | Default | Description |
|---|---|---|---|
| url | string | (required) | Target webpage URL to fetch |
| output_format | 'markdown' \| 'raw_html' \| 'text' | 'markdown' | Format of extracted content |
| profile_id | string | 'chrome124_win' | TLS fingerprint profile: chrome124_win, chrome120_mac, safari17_mac, edge101_win |
| timeout | number | 20 | Upstream scraper timeout in seconds |
| max_retries | number | 2 | Number of automated challenge retry attempts |
🛡️ Error Handling
import { AntiBotScraperClient, AntiBotScraperError } from '@nhinguyen122026/antibot-scraper-client';
const scraper = new AntiBotScraperClient();
try {
const res = await scraper.scrape({ url: 'https://protected-site.com' });
} catch (err) {
if (err instanceof AntiBotScraperError) {
console.error(`Scrape Error [Status ${err.statusCode}]:`, err.message);
console.error('Raw details:', err.rawData);
} else {
console.error('Network or timeout error:', err);
}
}📄 License
MIT © Duong Y Nhi
