WaspCode Bot
Deploy Cloudflare Bypass API to HF Spaces
f262da8
Raw History Blame Contribute Delete
2 kB
import requests
import time
import os
# Read from environment, default to HF Spaces port
API_URL = os.getenv("API_URL", "http://127.0.0.1:7860/scrape")
API_KEY = os.getenv("API_KEY", "my_secret_key_123")
SITES = [
("🟒 No CF (httpbin)", "https://httpbin.org/headers"),
("🟑 Medium CF (G2.com)", "https://www.g2.com"),
("πŸ”΄ Strict CF", "https://nowsecure.nl"),
("πŸ”΄ Turnstile Demo", "https://demo.turnstile.workers.dev/"),
("🟑 Indeed (job site)", "https://www.indeed.com"),
]
print("\n" + "="*62)
print(" πŸ”¬ LIVE 3-STAGE BYPASS TEST β€” 5 REAL SITES")
print("="*62)
results = []
for label, url in SITES:
print(f"\n {label}")
print(f" URL: {url[:55]}")
print(f" {'─'*52}")
try:
headers = {"X-API-Key": API_KEY}
resp = requests.post(API_URL, json={"url": url}, headers=headers, timeout=60).json()
stage = resp.get("stage", "?")
method = resp.get("method", "?")
t = resp.get("time_seconds", "?")
cookies = resp.get("cookies", {})
token = resp.get("token")
html = (resp.get("html") or "")[:80].replace("\n", " ")
print(f" βœ… Stage {stage}: {method}")
print(f" ⏱ Time: {t}s")
print(f" πŸͺ Cookies: {len(cookies)}" + (f" πŸ”‘ Token: {token[:25]}..." if token else ""))
print(f" πŸ“„ Preview: {html}...")
results.append((label, "βœ… PASS", stage, t))
except Exception as e:
print(f" ❌ FAILED β€” {str(e)[:80]}")
results.append((label, "❌ FAIL", "β€”", "β€”"))
print("\n" + "="*62)
print(" πŸ“Š SUMMARY TABLE")
print("="*62)
print(f" {'Site':<28} {'Result':<10} {'Stage':<8} {'Time'}")
print(f" {'─'*28} {'─'*10} {'─'*8} {'─'*8}")
for label, result, stage, t in results:
print(f" {label:<28} {result:<10} {str(stage):<8} {t}s")
wins = sum(1 for _, r, _, _ in results if "PASS" in r)
print(f"\n Score: {wins}/5 sites bypassed")
print("="*62)