wuhp commited on
Commit
02f919f
·
verified ·
1 Parent(s): 4f87e76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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
- dec = bencodepy.Bencode(encoding=None)
84
- data = dec.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"]
 
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"]