metadatabittorrentdhtinfo-hash

Getting a torrent title from metadata or torrent file


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


Solution

  • 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}}