@rafaelgdn/browser-scraper
v0.2.0
Published
CDP-first browser automation library with closed Shadow DOM access, profile seeding, and antibot-oriented features
Maintainers
Readme
Browser Scraper
@rafaelgdn/browser-scraper is a CDP-first browser scraping package for Node.js, preserving the same public API and the same design direction used in the original GDNox prototype.
Status
This package has the core ported:
- Direct Chrome launch with raw CDP
- Tab/page control
- Unified DOM search with shadow root piercing
- OOP iframe support
- Element interactions
- Network monitoring and interception
- Profile seeding
Install
pnpm installIf pnpm blocks native build scripts, run:
pnpm rebuild better-sqlite3 esbuildUsage
import { Browser } from "@rafaelgdn/browser-scraper";
const browser = new Browser();
try {
const tab = await browser.new_tab();
await tab.goto("https://example.com");
const heading = await tab.find("h1");
console.log(await heading?.text());
} finally {
await browser.close();
}API
Browser
new Browser({
chrome_path: null,
headless: false,
user_data_dir: null,
proxy: null,
extra_args: [],
auto_seed: true,
});Tab
await tab.goto(url, "load", 30);
await tab.find(selector, 5);
await tab.find_all(selector);
await tab.wait_for_selector(selector, false, false, 30);
await tab.wait_for_function(expression, 30);
await tab.race([".success"], ["window.done === true"], false, 30);
await tab.evaluate("document.title");
await tab.screenshot("shot.png");
await tab.content();
await tab.sleep(2);Element
await element.click();
await element.type("hello");
await element.text();
await element.inner_html();
await element.get_attribute("href");
await element.set_attribute("data-test", "1");
await element.is_visible();Notes
- The port currently mirrors the real implemented behavior in the Python package.
- The dedicated fingerprint and runtime stealth modules were removed from the Node package because enabling them increased Cloudflare detection in testing.
Publish
Build the package first:
pnpm buildInspect the publishable tarball locally:
pnpm packLog into npm:
npm login
npm whoamiPublish the scoped package publicly:
pnpm publish --access public --no-git-checks