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_magnet(magnet, output_dir)

if handle:
    while True:
        status, props = handle.read(sleep=1)
        if not status: continue
        print(f"{props['name']}, {props['download_speed_human']}, {props['progress']}%")
        if props['is_finished']: break

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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for libtorrentx-0.0.5.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 9181724ddbea49e16320b524ac2d1c800c06fab629ae0c0d3060cff161034412
MD5 6714c9e653bd3b5fa21e71d88b7bba41
BLAKE2b-256 46d2e2ca20f4b12c303ce1b7e2c8b0351d10435ccc583d2d8bcf0586e00d35a1

See more details on using hashes here.

Supported by

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