torrent_info() and magnet links in libtorrent python bindings

前端 未结 1 1351
猫巷女王i
猫巷女王i 2021-02-11 01:34

I was searching how to pass an argument in torrent_info() function during the use of magnet links in libtorrent. Especially my target is to analyze peers and pieces. With the us

相关标签:
1条回答
  • 2021-02-11 02:20

    Adding a magnet link gives you a torrent handle, from which you will be able to get torrent infos (once the metadata has been fetched - it will throw otherwise).

    Unlike torrent files, where the metadata is already here, magnet links require the metadata to be retrieved from the network as a starter, and that can take some time.

    I'm more used to the C++ library, but well - to have it demo at the dirtiest, you can do something in the line of:

    handle = lt.add_magnet_uri(ses, link, params)
    while (not handle.has_metadata()):
       time.sleep(.1)
    info = handle.get_torrent_info()
    

    ... then, you can read all about it here ;) http://www.rasterbar.com/products/libtorrent/manual.html#torrent-info

    0 讨论(0)
提交回复
热议问题