Skip to main content

Turn a bittorrent magnet links into a .torrent file.

Project description


Pure python project to turn a magnet link into a .torrent file. The goal is to do it as fast as possible.

Getting Started


pip install magnet2torrent


Download an ubuntu iso torrent.

magnet2torrent fetch "magnet:?xt=urn:btih:e2467cbf021192c241367b892230dc1e05c0580e&dn=ubuntu-19.10-desktop-amd64.iso&"

Run it as an HTTP server.

magnet2torrent serve

Use from python

import asyncio

from magnet2torrent import Magnet2Torrent, FailedToFetchException

async def fetch_that_torrent():
    m2t = Magnet2Torrent("magnet:?xt=urn:btih:e2467cbf021192c241367b892230dc1e05c0580e&dn=ubuntu-19.10-desktop-amd64.iso&")
        filename, torrent_data = await m2t.retrieve_torrent()
    except FailedToFetchException:


  • [ ] DHT support


This project is licensed under the MIT License - see the file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for magnet2torrent, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size magnet2torrent-1.0.2-py3-none-any.whl (13.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page