TorrentBD API
Unofficial API for TorrentBD with search and profile access.
Overview
TorrentBD API is a Python package that provides a RESTful API wrapper for the TorrentBD website. It handles authentication, session management, and parsing of web content.
Disclaimer
This project is not affiliated with or endorsed by TorrentBD. This is an unofficial API created for educational purposes only. Use at your own risk.
Features
- Search torrents with pagination
- Access user profile information
- Automated login with reCAPTCHA solving
- Configurable via command line, environment variables, or config file
- Web UI for easy access
Installation
pip install tbd-api
Requirements
- Python 3.12 or later
- Chrome or Chromium browser (for login functionality)
- ChromeDriver (compatible with your Chrome/Chromium version)
Usage
Command Line
# Basic usage
tbd-api
# With credentials
tbd-api --username "user" --password "pass" --totp-secret "secret"
# Custom host and port
tbd-api --host "127.0.0.1" --port 8000
API Endpoints
| Endpoint | Method | Description | Parameters |
|---|---|---|---|
/search |
GET | Search torrents | query (required): Search termpage (optional): Page number (default: 1) |
/profile |
GET | Get user profile | None |
/online |
GET | Get the list of online users | None |
Configuration
Command-Line Arguments
usage: tbd-api [-h] [--username USERNAME] [--password PASSWORD] [--totp-secret TOTP_SECRET]
[--port PORT] [--host HOST] [--cookies COOKIES]
options:
-h, --help show this help message and exit
--username USERNAME TorrentBD username
--password PASSWORD TorrentBD password
--totp-secret TOTP_SECRET
TOTP secret for 2FA
--port PORT Port to run the server on (default: 5000)
--host HOST Host to bind the server to (default: 0.0.0.0)
--cookies COOKIES Path to cookies file
Configuration Files
All data is automatically saved in ~/.config/tbd-api/:
- Credentials and settings:
config.json - Login cookies:
cookies.txt(Netscape format)
Cookie Management
You can use the Get cookies.txt LOCALLY Chrome extension to export cookies from TorrentBD in Netscape format and save them to ~/.config/tbd-api/cookies.txt. This is useful when you want to bypass the automated login process.
Environment Variables
You can also use a .env file in the project folder:
TORRENTBD_USERNAME=username@mail.com
TORRENTBD_PASSWORD=secure_password
TORRENTBD_TOTP_SECRET=base32secret3232
Docker
# Build the image
docker build -t tbd-api .
# Run the container
docker run -p 5000:5000 tbd-api --username "user" --password "pass" --totp-secret "secret"
# or with environment variables
docker run --env-file .env -p 5000:5000 tbd-api
Development
# Clone the repository
git clone https://github.com/TanmoyTheBoT/torrentbd-api.git
cd torrentbd-api
# Install in development mode
make install
# Run
make run
# Run tests
make check
# Run linters
make lint
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for tbd-api 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tbd_api-0.0.6.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tbd_api-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.2 kB
Release files / tbd_api-0.0.6.tar.gz
| Download URL | tbd_api-0.0.6.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
999051bcef48a752f1b002b3328f0f6e62bbe124a606d6ad4351cc4fdb55a6b5
|
|
BLAKE2b-256 checksum How to use checksums |
7c755c7ad606e34445f5f0f8b44aad971d9a449c3cb6caafd59dd2ac80bd8666
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / tbd_api-0.0.6-py3-none-any.whl
| Download URL | tbd_api-0.0.6-py3-none-any.whl |
|---|---|
| Size | 24.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac6f25dc3db920c0b950c2706ff1ced74332bb3f9f88ab1329603341c9fa97c5
|
|
BLAKE2b-256 checksum How to use checksums |
6109b0422cc33ed0721bd8a044ce25bfdd98425e1862698b14ad78d2da84eb00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|