ts-web-scraper
Version:
A powerful web scraper for both static and client-side rendered sites using only Bun native APIs
42 lines • 1.27 kB
TypeScript
/**
* Scrape a client-side rendered website
*/
export declare function scrapeClientSide(url: string, options?: ClientSideScraperOptions): Promise<ScrapedData>;
/**
* Helper: Extract data from a client-side rendered page automatically
*/
export declare function extractData(url: string, options?: ClientSideScraperOptions): Promise<any>;
/**
* Check if a site is client-side rendered
*/
export declare function isClientSideRendered(url: string): Promise<boolean>;
/**
* Client-Side Web Scraper - Handles JavaScript-rendered sites
*
* This scraper can extract data from client-side rendered applications
* (React, Vue, Next.js, etc.) by analyzing JavaScript bundles and finding
* API endpoints or embedded data.
*
* Uses ONLY Bun native APIs - no external dependencies!
*/
export declare interface ClientSideScraperOptions {
timeout?: number
headers?: Record<string, string>
userAgent?: string
analyzeJavaScript?: boolean
findEmbeddedData?: boolean
reconstructAPI?: boolean
maxJSFiles?: number
}
export declare interface ScrapedData {
html: string
scriptUrls: string[]
apiEndpoints: string[]
embeddedData: Record<string, any>
apiResponses: Map<string, any>
meta: {
title?: string
description?: string
[key: string]: any
}
}