idlesign / torrentool

The tool to work with torrent files.
https://github.com/idlesign/torrentool
BSD 3-Clause "New" or "Revised" License
148 stars 30 forks source link

does not work with magnet link? #12

Open mzramna opened 4 years ago

mzramna commented 4 years ago

there is any way to load the torrent status nly by the magnet link?

idlesign commented 4 years ago

Currently no. But I was thinking it over last month. I'll make an experiment and add support if success.

modbender commented 3 years ago

Any progress here? Been months. I have been using this for some weeks and now am in a position that I need to create torrent file from magnet link. Was looking at something like this: https://stackoverflow.com/questions/8689828/libtorrent-given-a-magnet-link-how-do-you-generate-a-torrent-file, if it's possible for them it's not like it's not possible for this.

idlesign commented 3 years ago

No progress so far. Thnk you for the link, I'll look into it in a week.

idlesign commented 3 years ago

About the link. libtorrent is a full featured torrent client library.

To implement full .torrent file reconstruction from a magnet link one needs to: implement DHT (BEP5) client, which will find nodes and peers, then connect to a peer and download metadata (BEP9).

The above said seems to be out of scope of a tool working with .torrent files such as torrentool. Adding dependencies also seems undesirable.

I've started implementation of a small DHT client, but it never went further.

modbender commented 3 years ago

@idlesign How about this?

https://blog.xyzio.com/2019/12/23/convert-magnet-link-to-torrent-file-with-python-and-add-additional-trackers/

idlesign commented 3 years ago

This link is primarily about uri parsing. Magnet links may include as little as only info hash, so no information about trackers, files etc. may be available. Given that we couldn't reconstruct a full .torrent file from a magnet link without DHT, etc.

The linked code puts magnet-uri entry in a generated torrent file, but it's not an official extension af far as I know. Maybe it is supported solely by rtorrent, maybe not. That should be investigated.

If magnet-uri is supported by major torrent clients, and we're ok with such quazzy torrent files we can try and implements support for that.