Skip to main content

libtorrent python api

Project description

LibtorrentX

A python wrapper for libtorrent, makes it easy to manage torrents. Built in support for state management and state recovery after restart.

  • Easily pause and resume your torrent streams.
  • Optimized settings for faster download speeds.

Install via pip

pip install libtorrentx

Simple demo app

from libtorrentx import LibTorrentSession
import time

magnet = "magnet:?xt=urn:btih:4C9B41D664D7B6B23F0BF39AE185858CBADDA3FF"
output_dir = "./downloads"
session = LibTorrentSession()
handle = session.add_torrent(magnet, output_dir)

while True:
    props = handle.props()

    if not props.ok:
        print("waiting for torrent to start...")
        time.sleep(1)
        continue

    print(props.string)

    if props.is_finished:
        break

    time.sleep(1)

or use CLI python -m libtorrentx -m magnet:?xt=urn:btih:4C9B41D664D7B6B23F0BF39AE185858CBADDA3FF

Output

Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 1.20 MB/s, 19%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 12.00 MB/s, 19%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 28.11 MB/s, 77%
Spider-Man.No.Way.Home.2022.1080p.BluRay.1600MB.DD5.1.x264-GalaxyRG[TGx], 29.00 MB/s, 100%

You can stop the execution and restart again, the download will resume from previous state.

Install via Docker

docker build . -t libtorrentx
docker run --rm -it -v $(pwd)/downloads:/app/downloads libtorrentx -m magnet:?xt=urn:btih:4C9B41D664D7B6B23F0BF39AE185858CBADDA3FF

Project details


Download files

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

Source Distribution

libtorrentx-0.0.8.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libtorrentx-0.0.8-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file libtorrentx-0.0.8.tar.gz.

File metadata

  • Download URL: libtorrentx-0.0.8.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for libtorrentx-0.0.8.tar.gz
Algorithm Hash digest
SHA256 de47a39e2d7dc5328e33a055c765c57b9ba4d1a306d9246e2ff54d5832dae9ac
MD5 fcf6d3eeb56f46ec3b91a1d9ffef7813
BLAKE2b-256 9311de8a026c76095ee4b1dc8aaf23dc6386197ec068c7728b7b8e1c93d714a7

See more details on using hashes here.

File details

Details for the file libtorrentx-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: libtorrentx-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for libtorrentx-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3482d78f77c4646e405f4405ae0178d1acde7199de1877c7b097fee1c02a0b72
MD5 e1662aef442b231c4dcea73ad588cc7e
BLAKE2b-256 ab39c6f5a9789c7cf8cfc0ade218f25d558af2e99bd9cde1b31c5f1810f63d57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page