Spaces:
Running
Running
Commit ·
ad20b55
1
Parent(s): 30720b7
debug: add video POST error logging
Browse files650 unmodified lines651652653654654655656657658657659660661662663664665662666667668669664670671672673674675650 unmodified lines f"{CASTLE_BASE}/film-api/v2.0.1/movie/getVideo?clientType={CLI}&packageName={PKG}&channel={CH}&lang={LANG}", json=body, headers={"Content-Type": "application/json"} ) if vr.status_code != 200: continue if vr.status_code != 200: errors.append(f"Castle: video HTTP {vr.status_code} res={resolution}") continue try: vp = cdec(vr.text) except: continue except Exception as vde: errors.append(f"Castle: video decrypt fail res={resolution}: {vde}") continue vd = vp.get("data", vp) if isinstance(vd, str): try: vd = json.loads(vd) except: continue if not isinstance(vd, dict): continue if not isinstance(vd, dict): errors.append(f"Castle: video not dict res={resolution}: {type(vd)}") continue vurl = vd.get("videoUrl", "") if not vurl: continue if not vurl: errors.append(f"Castle: no videoUrl res={resolution}, keys={list(vd.keys())[:5]}") continue
quality_map = {1: "480p", 2: "720p", 3: "1080p"} quality = quality_map.get(resolution, "720p")main.py+12-4