Getting a torrent title from metadata or torrent file

4k Views Asked by At

Is it possible to extract the torrent title from the meta data loaded from DHT or the file downloaded from some server like TPB? any api,lib any language would do

3

There are 3 best solutions below

0
On BEST ANSWER

Using python you can easily read/edit a torrent file using bencode.py module

Example:

>>> import bencode
>>> rawdata = open('foo.torrent').read()
>>> bencode.bdecode(rawdata)
{'announce': 'http://cbbatracker.appspot.com/announce',
 'comment': 'HOTD for testing purposes',
 'created by': 'Transmission/2.04 (11151)',
 'creation date': 1292094068,
 'encoding': 'UTF-8',
 'info': {'length': 262212441,
          'name': '[SnF] Highschool of the Dead 02 [285FB2DA].mp4',
          'piece length': 131072,
          'pieces': '...lot of binary data...',
          'private': 0}}
1
On

yes it's possible. Lot of open source torrent softwares use the libtorrent library. It's available in C++ langage

libtorrent

0
On

You have to be more specific what you actually mean. If you meant "info.name" from the metafile, then any bencode module for any language makes that rather easy.