Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files493 unmodified lines4944954964974984992 unmodified lines502503504505506493 unmodified lines}@app.get("/")async def root():return {2 unmodified lines"endpoints": {"/scrape": "Get streaming links (params: id, type, season, episode)","/proxy": "Proxy m3u8/segments (params: url, origin, referer)",}}493 unmodified lines4944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395402 unmodified lines543544545546547548493 unmodified lines}@app.get("/debug")async def debug_connectivity():"""Debug endpoint to check what HF can reach."""results = {}async with httpx.AsyncClient(timeout=10.0, follow_redirects=True) as client:# Test allmovieland homepagetry:r = await client.get(f"{MOVIELAND_BASE}/", headers={"User-Agent": UA})results["allmovieland_home"] = {"status": r.status_code, "len": len(r.text), "has_PHPSSESSID": "PHPSESSID" in str(r.cookies)}except Exception as e:results["allmovieland_home"] = {"error": str(e)[:80]}# Test films pagetry:r = await client.get(f"{MOVIELAND_BASE}/films/", headers={"User-Agent": UA})results["allmovieland_films"] = {"status": r.status_code, "len": len(r.text)}except Exception as e:results["allmovieland_films"] = {"error": str(e)[:80]}# Discover player domainplayer_domain = await _discover_player_domain(client)results["player_domain"] = player_domain or "NOT FOUND"# Test player domain embed directlyif player_domain:try:r = await client.get(f"{player_domain}/play/tt16366836", headers={"User-Agent": UA, "Referer": f"{MOVIELAND_BASE}/"})results["embed_test"] = {"status": r.status_code, "len": len(r.text), "has_p3": "let p3" in r.text}except Exception as e:results["embed_test"] = {"error": str(e)[:80]}else:# Try hardcoded fallbacktry:r = await client.get("https://piexe411qok.com/play/tt16366836", headers={"User-Agent": UA, "Referer": f"{MOVIELAND_BASE}/"})results["embed_fallback"] = {"status": r.status_code, "len": len(r.text), "has_p3": "let p3" in r.text}except Exception as e:results["embed_fallback"] = {"error": str(e)[:80]}return results@app.get("/")async def root():return {2 unmodified lines"endpoints": {"/scrape": "Get streaming links (params: id, type, season, episode)","/proxy": "Proxy m3u8/segments (params: url, origin, referer)","/debug": "Check connectivity to AllMovieLand from this server",}}
app.py+42