Skip to main content

Download from torrent with magnet link or .torrent file

Project description

TorrentP

Wrapped python library for downloading from torrent

Torrentp

Download from torrent with .torrent file or magnet link. With just 3 lines of python code.

PyPI version Supported Python versions Downloads

Installation

$ pip install torrentp

Also can be found on pypi

How can I use it?

  • Install the package by pip package manager.
  • After installing, you can use it and call the library.
  • You have to pass magnet link or torrent file, and a path for saving the file. use . (dot) for saving in current directory.

Download with magnet link:

import asyncio
from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("magnet:...", '.')
# Start the download process
asyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method 

# Pausing the download
torrent_file.pause_download()

# Resuming the download
torrent_file.resume_download()

# Stopping the download
torrent_file.stop_download()

Or download with .torrent file:

import asyncio
from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("test.torrent", '.')
# Start the download process
asyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method 

# Pausing the download
torrent_file.pause_download()

# Resuming the download
torrent_file.resume_download()

# Stopping the download
torrent_file.stop_download()

How can I use a custom port?

torrent_file = TorrentDownloader("magnet/torrent.file", '.', port=0000)

How can I limit the upload or download speed?

Download Using 0 (default number) means unlimited speed:

await torrent_file.start_download(download_speed=0, upload_speed=0)

Or download with specifc number (kB/s):

await torrent_file.start_download(download_speed=2, upload_speed=1)

Using Command Line Interface (CLI)

Download with a magnet link:

$ torrentp --link 'magnet:...'

or download with .torrent file:

$ torrentp --link 'test.torrent'

You can also use --help parameter to display all the parameters that you can use

args help type
--link Torrent link. Example: [--link 'file.torrent'] or [--link 'magnet:...'] [required] str
--download_speed Download speed with a specific number (kB/s). Default: 0, means unlimited speed int
--upload_speed Upload speed with a specific number (kB/s). Default: 0, means unlimited speed int
--save_path Path to save the file, default: '.' str
--stop_after_download Stop the download immediately after completion without seeding flag
--help Show this message and exit

Example with all commands:

$ torrentp --link 'magnet:...' --download_speed 100 --upload_speed 50 --save_path '.' --stop_after_download

To do list

  • Limit upload and download speed
  • User can change the port
  • CLI
  • Pause / Resume / Stop

Star History

Star History Chart

Issues

Feel free to submit issues and enhancement requests or contact me via vida.page/nima.

Contributing

Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Update the Version inside init.py
  4. Commit changes to your own branch
  5. Push your work back up to your fork
  6. Submit a Pull request so that we can review your changes

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

torrentp-0.2.6.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

torrentp-0.2.6-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file torrentp-0.2.6.tar.gz.

File metadata

  • Download URL: torrentp-0.2.6.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torrentp-0.2.6.tar.gz
Algorithm Hash digest
SHA256 ad23398bb650dbf7f591c3f28cef07dd305989626c862ae7e3de788ba2d0dfde
MD5 872153ec949f1b322867ae2d95be4b7d
BLAKE2b-256 44f546b64dca0e73b1954a0ae323ebc45f46d11ea15d0503421bc86233f2fa6b

See more details on using hashes here.

File details

Details for the file torrentp-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: torrentp-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for torrentp-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cf90ce4ed3bc5acadab8aa02c5d94f240bd5620032840fa128fff3d04b493e35
MD5 3c2f423e0f019aece8a2e01756b4dabe
BLAKE2b-256 708a732c2f6940bad2cfd023bac823cc10891dacfa5f8222be0186ca96de0616

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