Open
Description
I recently encountered this torrent file in the wild and it has one invalid tracker url out of many.
Trying to read it raises a metainfo error
Traceback (most recent call last):
File "C:\Users\raven\Documents\GitHub\TEST\test.py", line 10, in <module>
torrent = Torrent.read_stream(BytesIO(open(path, "rb").read()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\raven\Documents\GitHub\TEST\.venv\Lib\site-packages\torf\_torrent.py", line 1632, in read_stream
torrent.validate()
File "c:\Users\raven\Documents\GitHub\TEST\.venv\Lib\site-packages\torf\_torrent.py", line 1388, in validate
utils.assert_type(md, ('announce-list', i, j), (str,), check=utils.is_url)
File "c:\Users\raven\Documents\GitHub\TEST\.venv\Lib\site-packages\torf\_utils.py", line 727, in assert_type
raise error.MetainfoError(f"{keychain_str}[{key!r}] is invalid: {obj[key]!r}")
torf._errors.MetainfoError: Invalid metainfo: ['announce-list'][4][0] is invalid: '*udp://9.rarbg.to:2710/announce'
I understand this is an invalid URL but is it possible to drop invalid metainfo instead of erroring? especially non critical ones like this where there are several more working trackers. This is a perfectly downloadable torrent and clients like Qbit simply report it as unsupported while continuing to download it
Possibly a strict: bool = True
flag in read()
and read_stream()
where:
- True behaves like the current behavior, erroring at any metainfo error
- False drops non critical info instead of erroring
Thank you
Metadata
Metadata
Assignees
Labels
No labels