Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlf20010508/ltorrent
A pure python torrent client based on PyTorrent
https://github.com/hlf20010508/ltorrent
bittorrent pytorrent torrent
Last synced: about 5 hours ago
JSON representation
A pure python torrent client based on PyTorrent
- Host: GitHub
- URL: https://github.com/hlf20010508/ltorrent
- Owner: hlf20010508
- License: unlicense
- Created: 2023-11-26T09:07:20.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2023-12-05T09:53:57.000Z (12 months ago)
- Last Synced: 2023-12-05T20:45:10.796Z (12 months ago)
- Topics: bittorrent, pytorrent, torrent
- Language: Python
- Homepage:
- Size: 297 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LTorrent
A pure python torrent client based on PyTorrent- Pure Python client.
- Based on [gallexis/PyTorrent](https://github.com/gallexis/PyTorrent).
- Support [torrent file](#torrent-file) and [magnet link](#magnet-link).
- Scrape `udp` or `http` trackers with multiple thread.
- Connect to peers with multiple thread.
- Support [custom storage](https://github.com/hlf20010508/LTorrent/tree/master/examples/custom_storage.py).
- Support file selection.
- Support custom [stdout](https://github.com/hlf20010508/LTorrent/tree/master/examples/custom_stdout.py).
- Support [running as a thread](#run-as-a-thread).
- Support [asynchrony](#asynchrony).
- Support [sequential download](https://github.com/hlf20010508/LTorrent/tree/master/examples/sequential.py).See examples [here](https://github.com/hlf20010508/LTorrent/tree/master/examples).
## Todo
- Download more than one torrent at a time.
- Pause and resume download.
- Scrape peers while downloading.
- Accept new peers while downloading.## File Selection
Input number of files, seperated by `Space`, eg: `2 5 7`.Range supported, linked by `-`, eg: `4 6-10 12 14-20`.
## Installation
### ltorrent
pip
```sh
pip install git+https://github.com/hlf20010508/[email protected]#subdirectory=ltorrent
```
pipenv
```sh
pipenv install "ltorrent@ git+https://github.com/hlf20010508/[email protected]#subdirectory=ltorrent"
```### ltorrent_async
pip
```sh
pip install git+https://github.com/hlf20010508/[email protected]#subdirectory=ltorrent_async
```
pipenv
```sh
pipenv install "ltorrent_async@ git+https://github.com/hlf20010508/[email protected]#subdirectory=ltorrent_async"
```## Start
### Run Demo
```sh
pipenv install
pipenv run python demo.py
```### Torrent File
```py
from ltorrent.client import Clienttorrent_path = "your-torrent-path"
port = 8080client = Client(
port=port
)client.load(torrent_path=torrent_path)
client.list_file()
selection = input("Select file: ")
client.select_file(selection=selection)
client.run()
```### Magnet Link
```py
from ltorrent.client import Clientmagnet_link = "your-magnet-link"
port = 8080client = Client(
port=port
)client.load(magnet_link=magnet_link)
client.list_file()
selection = input("Select file: ")
client.select_file(selection=selection)
client.run()
```### Run as a Thread
```py
from ltorrent.client import Clientmagnet_link = "your-magnet-link"
port = 8080client = Client(
port=port
)client.load(magnet_link=magnet_link)
client.list_file()
selection = input("Select file: ")
client.select_file(selection=selection)
client.start()
```### Asynchrony
```py
from ltorrent_async.client import Clientasync def main():
magnet_link = "your-magnet-link"
port = 8080client = Client(
port=port,
)await client.load(magnet_link=magnet_link)
await client.list_file()
selection = input("Select file: ")
await client.select_file(selection=selection)
await client.run()if __name__ == '__main__':
asyncio.run(main())
```