torrent_info() and magnet links in libtorrent python bindings

最后都变了- 提交于 2019-12-03 08:54:13

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!