No description
  • TypeScript 100%
Find a file
2026-06-28 06:54:32 +08:00
examples feat: improved docs and jsdoc 2026-06-20 23:53:22 +08:00
src bump verson 0.3.3 2026-06-28 06:54:32 +08:00
tests fix: scr-api client 2025-10-12 20:28:32 +08:00
.gitignore init 2025-10-11 20:39:55 +08:00
.prettierignore init 2025-10-11 20:39:55 +08:00
.prettierrc init 2025-10-11 20:39:55 +08:00
package.json bump verson 0.3.3 2026-06-28 06:54:32 +08:00
pnpm-lock.yaml init 2025-10-11 20:39:55 +08:00
pnpm-workspace.yaml feat: fetcher client 2026-06-20 23:27:34 +08:00
README.md feat: improved docs and jsdoc 2026-06-20 23:53:22 +08:00
rslib.config.ts init 2025-10-11 20:39:55 +08:00
rstest.config.ts init 2025-10-11 20:39:55 +08:00
tsconfig.json init 2025-10-11 20:39:55 +08:00

@tbdhdev/scrapers

TypeScript API wrapper for tbdsux's scraper API projects.

Install

# pnpm
pnpm add @tbdhdev/scrapers

# npm
npm install @tbdhdev/scrapers

# yarn
yarn add @tbdhdev/scrapers

# bun
bun add @tbdhdev/scrapers

Development

# watch building of lib
pnpm run dev

APIs

  • SCR-API — Web scraping & screenshots with optional ad-blocking
  • Rake — Advanced scraping with multiple backends and Cloudflare bypass
  • Fetcher — Simple web page content fetching

SCRApiClient

import { SCRApiClient } from '@tbdhdev/scrapers';

const client = new SCRApiClient();
// const client = new SCRApiClient("https://custom-base-api.tbdh.app/"); // Pass custom base url accordingly

Screenshot

const screenshot = await client.screenshot('https://example.com', {
  width: 1920,
  height: 1080,
  fullPage: false,
  imageType: 'png',
  waitTimeout: 5,
  useAdblock: false,
});

if (!screenshot.success) {
  console.error('Error taking screenshot:', screenshot.error);
  return;
}

// write to file
const arrBuffer = await screenshot.data.arrayBuffer();
const buffer = Buffer.from(arrBuffer);
writeFileSync('screenshot.png', buffer);

Scrape

const scrape = await client.scrape('https://example.com', {
  useAdblock: true,
});

if (!scrape.success) {
  console.error('Error scraping:', scrape.error);
  return;
}

console.log(`Output of example.com ::>\n\n${scrape.data}`);

RakeClient

import { RakeClient } from '@tbdhdev/scrapers';

const rake = new RakeClient();
// const rake = new RakeClient("https://custom-base-api.tbdh.app/"); // Pass custom base url accordingly

Scrape

const scrape = await rake.scrape('https://example.com', {
  response: 'md', // "html" | "md" .. default: "md"
  scraper: 'flaresolverr', // "flaresolverr" | "flaresolverr-alt" | "primp" | "requests" | "flare-bypasser"
});

if (!scrape.success) {
  console.error('Error scraping:', scrape.error);
  return;
}

console.log(`Output of example.com ::>\n\n${scrape.data}`);

Check API Status

const status = await rake.get();

if (status.success) {
  console.log('Rake API status:', status.data.message);
  console.log('Config:', status.data.config);
}

FetcherClient

import { FetcherClient } from '@tbdhdev/scrapers';

const fetcher = new FetcherClient();
// const fetcher = new FetcherClient("https://custom-base-api.tbdh.app/"); // Pass custom base url accordingly

Scrape

const scrape = await fetcher.scrape('https://example.com');

if (!scrape.success) {
  console.error('Error fetching:', scrape.error);
  return;
}

console.log(`Output of example.com ::>\n\n${scrape.data}`);

Types

All API clients return a discriminated union type FResponse<T>:

type FResponse<T> =
  | { success: true; data: T }
  | { success: false; error: string };

Use success to narrow the type and safely access either data or error.


© tbdsux | 2025