npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cfto

v1.0.2

Published

A client library for accessing the CF Bypass.

Readme

🚀 cfto

Klien API untuk CF Clearance Scraper
Bypass Cloudflare WAF & Turnstile tanpa browser headless.

cfto adalah klien ringan yang memungkinkan Anda mengakses fungsionalitas inti dari CF Clearance Scraper API.
Gunakan modul ini untuk mengatasi tantangan Cloudflare (seperti WAF dan Turnstile) tanpa menjalankan browser headless sendiri.


💾 Instalasi

# Menggunakan npm
npm install cfto

# Atau menggunakan yarn
yarn add cfto

📋 Penggunaan

Modul ini mendukung CommonJS (require) dan ES Modules (import).

Kami merekomendasikan menggunakan destructuring untuk memberi alias pada objek cfto menjadi cf.


🧱 CommonJS Example

const { cfto: cf } = require('cfto');

async function getSession() {
  try {
    const session = await cf.wafSession('https://example.com/protected', 'host:port');
    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 { cfto as cf } from 'cfto';

(async () => {
  try {
    const result = await cf.turnstileMin('https://forms.com/login', '0x4AAAAAAAT-yE...');
    console.log('Token Turnstile:', result.token);
  } catch (error) {
    console.error('Gagal:', error.message);
  }
})();

⚙️ ES Modules Example (Dynamic Import — Disarankan untuk Skrip Asinkron)

const cftoPromise = import('cfto');

async function runDynamicScraper() {
  const cftoModule = await cftoPromise;
  const cf = cftoModule.cfto || (cftoModule.default && cftoModule.default.cfto);

  try {
    const result = await cf.turnstileMin('https://forms.com/login', '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(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 yang dilindungi WAF | | proxy | string | ❌ Tidak | Alamat proxy opsional (user:pass@host:port) |

Contoh:

const { cfto: cf } = require('cfto');

async function getSession() {
  const session = await cf.wafSession('https://example.com/protected', 'host:port');
  console.log('Cookies:', session.cookies);
  console.log('Headers:', session.headers);
}

getSession();

2️⃣ cf.turnstileMin(url, siteKey, proxy?)

Menyelesaikan challenge Cloudflare Turnstile dengan mode minimal (cepat).
Mengembalikan token yang dapat diverifikasi di server Anda.

| Parameter | Tipe | Diperlukan | Deskripsi | |------------|--------|-------------|------------| | url | string | ✅ Ya | URL halaman dengan widget Turnstile | | siteKey | string | ✅ Ya | Site Key Turnstile | | proxy | string | ❌ Tidak | Proxy opsional |

Contoh:

const { cfto: cf } = require('cfto');

async function solveTurnstile() {
  const result = await cf.turnstileMin(
    'https://forms.com/login',
    '0x4AAAAAAAT-yE...', // Site Key
    'host:port'
  );
  console.log('Token Turnstile Min:', result.token);
}

solveTurnstile();

3️⃣ cf.turnstileMax(url, proxy?)

Mode maksimum (simulasi interaksi pengguna alami).
Lebih andal pada halaman yang memiliki proteksi ketat.

| Parameter | Tipe | Diperlukan | Deskripsi | |------------|--------|-------------|------------| | url | string | ✅ Ya | URL target Turnstile | | proxy | string | ❌ Tidak | Proxy opsional |


4️⃣ cf.source(url, proxy?)

Mengambil HTML yang sudah di-render oleh JavaScript dari suatu halaman.
Cocok untuk situs SPA (Single Page Application) atau konten dinamis.

| Parameter | Tipe | Diperlukan | Deskripsi | |------------|--------|-------------|------------| | url | string | ✅ Ya | URL target | | proxy | string | ❌ Tidak | Proxy opsional |

Contoh:

const { cfto: cf } = require('cfto');

async function getSource() {
  const result = await cf.source('https://spa-website.com/');
  console.log('HTML Source:', result.source.substring(0, 200) + '...');
}

getSource();

⚠️ Penanganan Error

Semua fungsi akan melempar Error jika:

  • Permintaan gagal di tingkat jaringan (misal: koneksi putus, DNS gagal)
  • API mengembalikan status 4xx atau 5xx
  • Parameter wajib hilang atau challenge gagal diselesaikan

Gunakan try...catch:

try {
  const token = await cf.turnstileMin(url, siteKey, proxy);
  console.log('Token:', token);
} catch (err) {
  console.error('cfto error:', err.message);
}

🔒 Catatan Keamanan

  • Token Turnstile harus diverifikasi di server-side.
  • Hindari menampilkan atau menyimpan token sensitif di log produksi.
  • Gunakan proxy secara bijak dan hanya dari sumber tepercaya.

🧠 Tips

  • Gunakan turnstileMin untuk kecepatan.
  • Gunakan turnstileMax jika challenge sulit dilewati.
  • wafSession() cocok untuk scraping awal sebelum request utama.
  • source() ideal untuk situs SPA atau konten JS-rendered.

📜 Lisensi

Lisensi mengikuti ketentuan dalam package.json atau repositori resmi proyek ini.