haidarcf
v1.0.8
Published
A client library and CLI tool for accessing the CF Bypass.
Downloads
1,341
Maintainers
Readme
haidarcf
Klien API untuk CF Clearance Scraper & Turnstile Solver
Bypass Cloudflare WAF & Turnstile tanpa browser headless.
haidarcf adalah klien ringan yang memungkinkan Anda mengakses fungsionalitas inti dari CF Clearance Scraper API.
Gunakan modul ini atau perintah CLI untuk mengatasi tantangan Cloudflare seperti WAF dan Turnstile tanpa menjalankan browser headless sendiri.
Instalasi
# Menggunakan npm secara lokal
npm install haidarcf
# Atau secara global untuk akses CLI
npm install -g haidarcfPenggunaan CLI (Command Line Interface)
Anda dapat menggunakan haidarcf langsung dari terminal melalui npx tanpa perlu menulis kode JavaScript:
1. WAF Session (Cookie & Headers Clearance)
npx haidarcf waf-session --url https://example.com/protected2. Solve Turnstile (Minimal Mode)
npx haidarcf turnstile-min --url https://forms.com/login --sitekey 0x4AAAAAAAT-yE...3. Solve Turnstile (Maximal Mode)
npx haidarcf turnstile-max --url https://forms.com/login4. Fetch Rendered HTML Source
npx haidarcf source --url https://spa-website.com/Options CLI:
| Opsi | Short | Deskripsi | Default |
|------|-------|-----------|---------|
| --url | -u | Target URL | https://example.com |
| --sitekey | -k | Turnstile SiteKey | 0x4AAAAAAAT-yE... |
| --proxy | -p | Proxy (host:port / user:pass@host:port) | Opsional |
Penggunaan Modul (JavaScript / Node.js)
Modul ini mendukung:
- CommonJS (
require) - ES Modules (
import)
Kami merekomendasikan menggunakan destructuring untuk memberi alias haidar menjadi cf.
CommonJS Example
const { haidar: cf } = require('haidarcf');
async function getSession() {
try {
// Contoh menggunakan format object
const session = await cf.wafSession({
url: 'https://example.com/protected',
proxy: 'host:port' // opsional
});
console.log('Cookies:', session.cookies);
console.log('User-Agent:', session.headers['user-agent']);
} catch (error) {
console.error('Gagal mendapatkan WAF Session:', error.message);
}
}
getSession();ES Modules Example (Static Import)
import { haidar as cf } from 'haidarcf';
(async () => {
try {
const result = await cf.turnstileMin({
url: 'https://forms.com/login',
siteKey: '0x4AAAAAAAT-yE...'
});
console.log('Token Turnstile:', result.token);
} catch (error) {
console.error('Gagal:', error.message);
}
})();ES Modules Example (Dynamic Import)
const haidarPromise = import('haidarcf');
async function runDynamicScraper() {
const haidarModule = await haidarPromise;
const cf =
haidarModule.haidar ||
haidarModule.haidarcf ||
(haidarModule.default && (haidarModule.default.haidar || haidarModule.default.haidarcf));
try {
const result = await cf.turnstileMin({
url: 'https://forms.com/login',
siteKey: '0x4AAAAAAAT-yE...'
});
console.log('Token Dynamic Import:', result.token);
} catch (error) {
console.error('Gagal menjalankan dynamic import:', error.message);
}
}
runDynamicScraper();API Reference
Semua fungsi bersifat async dan akan melempar Error jika terjadi kegagalan.
1. cf.wafSession()
cf.wafSession(url, proxy?)atau
cf.wafSession({ url, proxy? })Mengambil cookies dan headers untuk melewati Cloudflare WAF, sehingga request HTTP berikutnya dapat berjalan tanpa challenge.
| Parameter | Tipe | Diperlukan | Deskripsi |
|------------|------|-------------|------------|
| url | string | Ya | URL target (Contoh: https://example.com/protected) |
| proxy | string | Tidak | Proxy opsional (user:pass@host:port) |
2. cf.turnstileMin()
cf.turnstileMin(url, siteKey, proxy?)atau
cf.turnstileMin({ url, siteKey, proxy? })Menyelesaikan challenge Cloudflare Turnstile dengan mode minimal.
| Parameter | Tipe | Diperlukan | Deskripsi |
|------------|------|-------------|------------|
| url | string | Ya | URL target (Contoh: https://forms.com/login) |
| siteKey | string | Ya | Site Key (Contoh: 0x4AAAAAAAT-yE...) |
| proxy | string | Tidak | Proxy opsional |
3. cf.turnstileMax()
cf.turnstileMax(url, proxy?)atau
cf.turnstileMax({ url, proxy? })Mode maksimum dengan simulasi interaksi pengguna alami.
| Parameter | Tipe | Diperlukan | Deskripsi |
|------------|------|-------------|------------|
| url | string | Ya | URL target (https://forms.com/login) |
| proxy | string | Tidak | Proxy opsional |
4. cf.source()
cf.source(url, proxy?)atau
cf.source({ url, proxy? })Mengambil HTML yang sudah di-render oleh JavaScript dari suatu halaman.
Penanganan Error
try {
const token = await cf.turnstileMin({
url: 'https://forms.com/login',
siteKey: '0x4AAAAAAAT-yE...'
});
console.log('Token:', token);
} catch (err) {
console.error('haidarcf error:', err.message);
}Kontak & Pengembang
- Email: [email protected]
Lisensi
ISC License.
