Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,8 +80,8 @@ def fetch_bytes(url: str, timeout: int = 45) -> bytes:
|
|
| 80 |
return r.content
|
| 81 |
|
| 82 |
def parse_torrent(raw: bytes) -> Dict[str, Any]:
|
| 83 |
-
|
| 84 |
-
data =
|
| 85 |
if not isinstance(data, dict) or b"info" not in data:
|
| 86 |
raise ValueError("Invalid .torrent: missing 'info' dictionary.")
|
| 87 |
info = data[b"info"]
|
|
|
|
| 80 |
return r.content
|
| 81 |
|
| 82 |
def parse_torrent(raw: bytes) -> Dict[str, Any]:
|
| 83 |
+
# FIX: use top-level decode; there is no bencodepy.Bencode in current releases
|
| 84 |
+
data = bencodepy.decode(raw)
|
| 85 |
if not isinstance(data, dict) or b"info" not in data:
|
| 86 |
raise ValueError("Invalid .torrent: missing 'info' dictionary.")
|
| 87 |
info = data[b"info"]
|