简体   繁体   中英

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

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

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

libtorrent

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM