{"id":26644968,"url":"https://github.com/dhruvv1402/bittorrent-client-python","last_synced_at":"2025-07-14T19:35:56.723Z","repository":{"id":284062388,"uuid":"953695090","full_name":"dhruvv1402/BitTorrent-Client-Python","owner":"dhruvv1402","description":"A lightweight, asynchronous BitTorrent client implemented in Python. This project demonstrates the core functionality of the BitTorrent protocol, including peer communication, piece management, and file downloading.","archived":false,"fork":false,"pushed_at":"2025-03-23T23:27:38.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T00:26:33.568Z","etag":null,"topics":["asyncio","bencode","bittorrent","bittorrent-client","logging","python","requests","socket","threading","torrent"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dhruvv1402.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-23T23:18:26.000Z","updated_at":"2025-03-23T23:29:08.000Z","dependencies_parsed_at":"2025-03-24T00:27:07.603Z","dependency_job_id":"1ebe0a6e-c3f7-4cb0-b7d7-17e3aa2acc1f","html_url":"https://github.com/dhruvv1402/BitTorrent-Client-Python","commit_stats":null,"previous_names":["dhruvv1402/bittorrent-client-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruvv1402%2FBitTorrent-Client-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruvv1402%2FBitTorrent-Client-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruvv1402%2FBitTorrent-Client-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruvv1402%2FBitTorrent-Client-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhruvv1402","download_url":"https://codeload.github.com/dhruvv1402/BitTorrent-Client-Python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245352287,"owners_count":20601122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","bencode","bittorrent","bittorrent-client","logging","python","requests","socket","threading","torrent"],"created_at":"2025-03-24T21:21:08.223Z","updated_at":"2025-03-24T21:21:09.037Z","avatar_url":"https://github.com/dhruvv1402.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BitTorrent Client in Python 🐍\n\nA lightweight, asynchronous BitTorrent client implemented in Python. This project demonstrates the core functionality of the BitTorrent protocol, including peer communication, piece management, and file downloading.\n\n## Features 🌟\n- **Asynchronous I/O**: Built with `asyncio` for high-performance peer communication.\n- **Multi-File Support**: Handles both single-file and multi-file torrents.\n- **Piece Management**: Efficiently manages and validates downloaded pieces using SHA-1 hashes.\n- **Tracker Support**: Communicates with HTTP trackers to discover peers.\n- **Rich Progress Tracking**: Real-time download progress with the `rich` library.\n\n## How It Works 🛠️\n1. **Parse Torrent File**: Extracts metadata (e.g., trackers, piece hashes, file structure).\n2. **Connect to Trackers**: Retrieves a list of peers sharing the file.\n3. **Peer Communication**: Establishes connections with peers to request and download pieces.\n4. **Piece Validation**: Verifies downloaded pieces using SHA-1 hashes.\n5. **File Assembly**: Combines downloaded pieces into the final file(s).\n\n## Getting Started 🚀\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/bittorrent-client.git\n   ```\n2. Install dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n3. Run the client:\n   ```bash\n   python main.py /path/to/your.torrent\n   ```\n\n## Example Usage 📂\n```bash\npython main.py ubuntu-22.04.torrent\n```\n\n## Project Structure 📁\n```\nbittorrent-client/\n├── client/              # Core client modules\n│   ├── client.py        # Main client logic\n│   ├── torrent.py       # Torrent file parsing\n│   ├── tracker.py       # Tracker communication\n│   ├── peer.py          # Peer connection handling\n│   ├── piece_manager.py # Piece management\n│   └── utils.py         # Utility functions\n├── requirements.txt     # Dependencies\n└── main.py              # Entry point\n```\n\n## Dependencies 📦\n- `bencodepy`: For parsing `.torrent` files.\n- `requests`: For HTTP tracker communication.\n- `rich`: For beautiful progress tracking.\n- `async-timeout`: For handling timeouts in async operations.\n\n## Contributing 🤝\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n## License 📜\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvv1402%2Fbittorrent-client-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhruvv1402%2Fbittorrent-client-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruvv1402%2Fbittorrent-client-python/lists"}