@tbdhdev/scrapers
v0.2.0
Published
TS Api wrapper for @tbdsux's scraper api projects.
Readme
@tbdhdev/scrapers
TS Api wrapper for my scrapers.
Install
# pnpm
pnpm add @tbdhdev/scrapers
# npm
npm install @tbdhdev/scrapers
# yarn
yarn add @tbdhdev/scrapers
# bun
bun add @tbdhdev/scrapersDevelopment
# watch building of lib
pnpm run devAPIs
import { SCRApiClient } from '@tbdhdev/scrapers';
const scrapi = new SCRApiClient();
// const scrapi = new SCRApiClient("https://custom-base-api.tbdh.app/"); // Pass custom base url accordingly
// ===== screenshot
const screenshot = await scrapi.screenshot('https://example.com');
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 scrapi.scrape('https://example.com');
if (!scrape.success) {
console.error('Error scraping:', scrape.error);
return;
}
console.log(`Output of example.com ::>\n\n${scrape.data}`);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.get('https://example.com', {
response: 'md', // "html" | "md" .. default: "md"
});
if (!scrape.success) {
console.error('Error scraping:', scrape.error);
return;
}
console.log(`Output of example.com ::>\n\n${scrape.data}`);© tbdsux | 2025
