IPL-predictor / scraper.py
durgexh's picture
Upload 9 files
d8d4264 verified
Raw
History Blame Contribute Delete
1.98 kB
from curl_cffi import requests
from bs4 import BeautifulSoup
import json
LIVE_MATCH_URL = "https://www.espncricinfo.com/series/indian-premier-league-2024-1411166/chennai-super-kings-vs-royal-challengers-bengaluru-1st-match-1422119/live-cricket-score"
def bypass_firewall():
print("========================================")
print(" TLS FINGERPRINT SPOOFER ENGAGED ")
print("========================================")
print("Deploying curl-cffi to impersonate Chrome 120 TLS handshake at the C-level...")
try:
# Instead of launching a whole physical browser, we use the specific encryption
# signature of Chrome 120. Cloudflare looks at the raw binary packet and is tricked.
response = requests.get(
LIVE_MATCH_URL,
impersonate="chrome120",
headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}
)
soup = BeautifulSoup(response.text, 'html.parser')
title = soup.find('title')
if title:
print(f"\n[TARGET TAB VISUAL]: {title.text}")
if "Access Denied" in response.text or "Cloudflare" in response.text:
print("\n[!] TLS Spoofing failed. Our datacenter IP is likely blocked completely.")
else:
print("\n[+] SUCCESS! WE BROKE THE WALL.")
print("[+] Checking for Next.js internal JSON database...")
next_data = soup.find('script', id='__NEXT_DATA__')
if next_data:
print("[+] INTERNAL DATABASE LOCATED!")
live_json = json.loads(next_data.string)
print("[+] RAW DATA ACQUIRED.")
else:
print("[-] We broke the wall, but they moved the data. HTML parsing required.")
except Exception as e:
print(f"\n[!] Critical Error: {e}")
if __name__ == "__main__":
bypass_firewall()