Skip to main content

Unofficial API for TorrentBD

Project description

TorrentBD API

Unofficial API for TorrentBD with search and profile access.

Python Version License PyPI version PyPI Downloads

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 term
page (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.

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.6.tar.gz (21.5 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.6-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tbd_api-0.0.6.tar.gz
Algorithm Hash digest
SHA256 999051bcef48a752f1b002b3328f0f6e62bbe124a606d6ad4351cc4fdb55a6b5
MD5 7f377b110383cc3c383c0eebcb007550
BLAKE2b-256 7c755c7ad606e34445f5f0f8b44aad971d9a449c3cb6caafd59dd2ac80bd8666

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tbd_api-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6f25dc3db920c0b950c2706ff1ced74332bb3f9f88ab1329603341c9fa97c5
MD5 7b6b51f5568c5fa865e91de98be640d1
BLAKE2b-256 6109b0422cc33ed0721bd8a044ce25bfdd98425e1862698b14ad78d2da84eb00

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