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.3.tar.gz (17.3 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.3-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tbd_api-0.0.3.tar.gz
  • Upload date:
  • Size: 17.3 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.3.tar.gz
Algorithm Hash digest
SHA256 db0d2df3353cfe4a090de8b1c7006552e8d2379c6b6f49c35e374b0074aabef0
MD5 df6e5b79d3cae782544f5b79d52cc6cd
BLAKE2b-256 3c75909c0bfb7834d21aca8c98392dfcc1d4e59f2ea5bc83b84149abb7e43b3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tbd_api-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b37e2588aa7216068d88796a7fd810745e884fe2742d977a665508dffcb44dfc
MD5 c13e4078a40b951164bd8f58a22622dd
BLAKE2b-256 4714b2b4319af51eb728191da4902fad1074750830ea04686bae01ad25a845b9

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