From a2c93098086fbfc809abf645db5bfe20640c1ccb Mon Sep 17 00:00:00 2001 From: j Date: Tue, 28 Jul 2020 11:36:20 +0200 Subject: [PATCH] not all torrents have announce --- ox/torrent/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ox/torrent/__init__.py b/ox/torrent/__init__.py index 7818bc7..a250215 100644 --- a/ox/torrent/__init__.py +++ b/ox/torrent/__init__.py @@ -55,7 +55,8 @@ def get_torrent_info(data=None, file=None): tinfo[key] = metainfo[key] tinfo['size'] = file_length tinfo['hash'] = sha1(bencode(info)).hexdigest() - tinfo['announce'] = metainfo['announce'] + if 'announce' in metainfo: + tinfo['announce'] = metainfo['announce'] if file: tinfo['timestamp'] = os.stat(file).st_ctime return tinfo