rrr4 / debug_endpoints.py
minaewrw's picture
Initial backend deployment for Hugging Face Spaces
11757af
import asyncio
from curl_cffi.requests import AsyncSession
from urllib.parse import urlparse
async def test_endpoints():
filecode = 'vcnw55kah6kp'
domain = 'f75s.com' # Frame domain
frame_url = f"https://{domain}/xe4kq/{filecode}" # This might change per request, need valid one
# We first visit details to get fresh frame URL
async with AsyncSession(impersonate='chrome124', verify=False) as s:
print("1. getting fresh frame URL...")
r = await s.get(f"https://bysezejataos.com/api/videos/{filecode}/embed/details", headers={
"Referer": f"https://bysezejataos.com/e/{filecode}",
"X-Requested-With": "XMLHttpRequest"
})
if r.status_code != 200:
print("Failed to get details.")
return
details = r.json()
frame_url = details.get("embed_frame_url")
frame_domain = urlparse(frame_url).netloc
print(f"Fresh Frame: {frame_url}")
# Initialize session on frame
await s.get(frame_url, headers={"Referer": f"https://bysezejataos.com/e/{filecode}"})
base_api = f"https://{frame_domain}/api/videos/{filecode}"
candidates = [
f"{base_api}",
f"{base_api}/",
f"{base_api}/embed/timeslider",
f"{base_api}/timeslider",
f"{base_api}/stream", # We know this gives 403
f"{base_api}/download",
f"https://{frame_domain}/api/videos/stream/{filecode}"
]
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"Referer": frame_url,
"Origin": f"https://{frame_domain}",
"X-Requested-With": "XMLHttpRequest",
"X-Byse-Ads-Mode": "1"
}
print("\n--- Testing Endpoints ---")
for url in candidates:
print(f"\nTesting: {url}")
resp = await s.get(url, headers=headers)
print(f"Status: {resp.status_code}")
if resp.status_code == 200:
print(f"Response: {resp.text[:500]}")
elif resp.status_code == 403:
print(f"Response (403): {resp.text}")
if __name__ == "__main__":
asyncio.run(test_endpoints())