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.7.linux-x86_64.tar.gz (11.0 kB view details)

Uploaded Source

File details

Details for the file libtorrentx-0.0.7.linux-x86_64.tar.gz.

File metadata

  • Download URL: libtorrentx-0.0.7.linux-x86_64.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for libtorrentx-0.0.7.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 70174255cf2c2807763363261c5ac7580f6c1e93cc00e675a3fe771157c3c7c2
MD5 9bda5c0087d8ab4fe055545d154f8581
BLAKE2b-256 9d7d2b4626e550d2c4df98c236e13e0d3c07bce423ffda6236a1b79a0e9d1d83

See more details on using hashes here.

Supported by

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