A simple parser for .torrent
file.
Can also edit and write back to torrent format after version 0.2.0.
auto
as encoding(need chardet
installed)pip install torrent_parser
pytp test.torrent
cat test.torrent | pytp
>>> import torrent_parser as tp
>>> data = tp.parse_torrent_file('test.torrent')
>>> data['announce']
http://tracker.trackerfix.com:80/announce
>>> data['announce'] = 'http://127.0.0.1:12345'
>>> tp.create_torrent_file('new.torrent', data)
or you don't operate with file, just raw bytes:
>>> import torrent_parser as tp
>>> data = tp.decode(b'd3:negi-1ee')
>>> data['neg']
-1
>>> tp.encode(data)
b'd3:negi-1ee'
python -m unittest tests
See Changelog.
See License.
Version | Tag | Published |
---|---|---|
0.3.0 | 4yrs ago | |
0.2.0 | 4yrs ago | |
0.1.5rc1 | 4yrs ago | |
0.1.4 | 4yrs ago |