Skip to main content

Unofficial API for TorrentBD

Project description

TorrentBD API

Unofficial API for TorrentBD with search and profile access.

Python Version License

📋 Overview

TorrentBD API is a Python package that wraps the TorrentBD website into a RESTful API. 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.

🚀 Installation

pip install tbd-api

🖥️ System Requirements

For login functionality:

  • Chrome or Chromium browser
  • ChromeDriver (compatible with your Chrome/Chromium version)
  • v3cap package (automatically installed as dependency for reCAPTCHA handling)

Note: The login process uses v3cap for automated reCAPTCHA solving.

🔧 Quick Start

# Basic usage (uses saved config if available)
tbd-api

# With credentials (automatically saved to config)
tbd-api --username "user" --password "pass" --totp-secret "secret"

# Custom host and port
tbd-api --host "127.0.0.1" --port 8000

📋 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

All data is automatically saved in ~/.config/tbd-api/:

  • Credentials and settings: config.json
  • Login cookies: cookies.txt

Environment Variables

You can also use a .env file in the project folder:

USERNAME=your_username
PASSWORD=your_password
TOTP_SECRET=your_totp_secret

🔗 API Endpoints

Endpoint Description Parameters
/search Search torrents query (required): Search term
page (optional): Page number (default: 1)
/profile Get user profile None

🔐 Authentication Flow

The application follows this authentication sequence:

  1. First tries to use existing cookies if available
  2. If cookies are invalid, attempts login with credentials from:
    • Command-line arguments
    • Environment variables
    • Saved configuration file
  3. Successfully authenticated session cookies are saved for future use

🐳 Docker

Build and run with 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
docker run --env-file .env -p 5000:5000 tbd-api

🛠️ Development

Clone the repository and install in development mode:

git clone https://github.com/TanmoyTheBoT/torrentbd-api.git
cd torrentbd-api
pip install .

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

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

tbd_api-0.0.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

tbd_api-0.0.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file tbd_api-0.0.2.tar.gz.

File metadata

  • Download URL: tbd_api-0.0.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tbd_api-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e037bf1e357fbcfc61409d846838f72fe4fd6550b8131c80cf49f46c2bb7edef
MD5 a336a948897fa72797095f51d8f44140
BLAKE2b-256 3a3ca1bb1ff03f519fb74d38f97452e79c1aac2981fe2f3189e18f8b39b79cf5

See more details on using hashes here.

File details

Details for the file tbd_api-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tbd_api-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tbd_api-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 754a4ac66073dcfb4fd88901c5ab0b2786d517ad3c273465ccfe7d37bdd84d1c
MD5 d31aa0e3f875408e2e3ed89d46aa9aaf
BLAKE2b-256 f94c4b0c16372c129fc112db40746c01ebe7835c83a1963419458f8880783ce4

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