Stay up to date with Torrust!

Watch our GitHub repos

Hash2Torrent - Retrieve Torrent Files Effortlessly!

Published on 05/09/2024
Updated on 05/09/2024
4 min read
Hash2Torrent - Retrieve Torrent Files Effortlessly!

Hello, Torrust community!

We are thrilled to introduce our newest project: Hash2Torrent, a web service that allows you to easily retrieve torrent files using only their infohash (version 1).

Hash2Torrent is designed to make torrent management more accessible and user-friendly, without the need to install a BitTorrent client.

Why this tool

In our quest to find a straightforward tool that allows users to download torrent files directly from an infohash, we discovered that there wasn’t a simple, reliable service available. We set out to change that by creating Hash2Torrent — a service that fills this gap. With Hash2Torrent, you can now quickly download torrent files by simply entering the infohash on our website (hash2torrent.com) or using a direct URL format:

https://hash2torrent.com/{info-hash}

For example: https://hash2torrent.com/443c7602b4fde83d1154d6d9da48808418b181b6.

The service does NOT download the contents described in the torrent file. It only ask other peers for the torrent file, also called metainfo file. Besides, the file (called metadata in BEP 9) includes only the info dictionary because is the only part covered by the info-hash. See BEP 9 for more information.

Implementation

The project is a thin API wrapper that uses the Rust BitTorrent client rqbit. rqbit has an option to add a torrent to the client in list-only mode, meaning the torrent is not downloaded, but only listed in the client. When you add a new torrent from a magnet-link, the client automatically gets the torrent file from other peers if it’s available.

The API generates a magnet-link for the info-hash and adds that magnet-link to the client in list-only mode. The clients returns the torrent file.

For the time being, the service API only returns a direct (not user-friendly) timeout (408) if the client behind the service can’t find any peer having that torrent.

Alternative Methods

Traditionally, if you wanted to retrieve a torrent file using its infohash, you would have to:

  • Open a BitTorrent client that supports DHT (Distributed Hash Table).
  • Add the infohash as a magnet link.
  • Wait for the client to find peers that have the torrent file.

While this method works, it can be cumbersome and is not ideal if you’re looking for a lightweight solution or need to automate the process for integration into other services.

NOTICE: You need the DHT to find other peers having the torrent. In the future we could also also user to introduce a magnet-link that may contain a list of trackers. In that case, the client could use those tracker to find peers.

Benefits of Using Hash2Torrent

Hash2Torrent is all about simplicity and ease of integration:

  • User-Friendly Interface: Just like a Google search, simply type the infohash into our form, click download, and if peers are available, the torrent file will be downloaded within seconds.
  • Direct URL Access: Use our direct URL format to fetch torrent files programmatically, making it ideal for integration with other tools and services.
  • Efficiency: No need to deal with BitTorrent clients or complex setups. Hash2Torrent is the simplest way to get a torrent file from an infohash. We have also added a torrents cache so it will be even faster if the torrent is already cached.
  • Contribution to the Ecosystem: By providing this service, we aim to empower the community with more tools that enhance the overall BitTorrent experience.

Try it out! Visit Hash2Torrent (hash2torrent.com) and give it a try with your favorite torrents’ infohashes. We are eager to hear your feedback and suggestions.

Conclusion

We built Hash2Torrent to make torrent retrieval from infohashes as easy as possible. Whether you’re a casual user who needs the occasional torrent file or a developer looking to integrate torrent retrieval into your application, Hash2Torrent is here to help.

This project is just one of the many ways we plan to contribute to the BitTorrent ecosystem by providing practical, user-friendly tools. We believe in building a more accessible torrenting experience for everyone, and Hash2Torrent is a significant step in that direction. We are excited to continue innovating and supporting the community with more tools like this!

Happy torrenting!

Acknowledgments

A massive thank you to all contributors who made this project possible, especially those involved in developing the Rust-based BitTorrent client that powers Hash2Torrent, specially to Igor Katson whose work underpins Hash2Torrent. Their dedication and contributions have been instrumental in bringing this service to life.

If you have any questions or issues regarding this post, please open an issue.

For any other questions or issues related to Torrust repositories, please open an issue on the corresponding repository:

We very welcome any contributions to the project!