apify-node-curl-impersonate
v1.0.29
Published
A wrapper around cURL-impersonate, a binary which can be used to bypass TLS fingerprinting.
Readme
node-curl-impersonate
📦 NPM Package: apify-node-curl-impersonate
node-curl-impersonate is a library that allows for you to use curl-impersonate natively, providing an easy interface for passing headers, flags, and other information for your request. This library specifically is used to bypass TLS Fingerprinting that is present on some cloudflare or other DDOS protected sites. I do not support using this for malicious purposes, only to demonstrate that TLS Fingerprinting is not a safe way to secure your website from web scrapers, and to show how easy web scraping is in general.
Installation
It may be required to install some dependencies first for local development. On MacOS installing these via brew should be sufficient:
brew tap shakacode/brew brew install curl-impersonate
Using npm
npm install apify-node-curl-impersonateUsing yarn
yarn add apify-node-curl-impersonateUsing pnpm
pnpm add apify-node-curl-impersonateQuick Example
import { CurlImpersonate } from 'apify-node-curl-impersonate';
// Create client with browser preset and proxy
const client = new CurlImpersonate('https://httpbin.org/get', {
method: 'GET',
headers: {},
debugLogger: () => {},
impersonate: 'chrome-100', // Mimic Chrome browser
flags: ['--proxy', 'http://username:[email protected]:8080']
});
// Make a GET request
const response = await client.makeRequest();
console.log(response.data);
// For POST request, create a new instance
const postClient = new CurlImpersonate('https://httpbin.org/post', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: { message: 'Hello World' },
debugLogger: () => {},
impersonate: 'firefox-133' // Mimic Firefox browser
});
const postResponse = await postClient.makeRequest();
console.log(postResponse.data);The library supports multiple browser presets including Chrome, Firefox, Safari, and Edge with various versions. See the BrowserPresets type and PRESETS object for the complete list of available browser presets.
