File size: 1,997 Bytes
f262da8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 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)
|