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

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:

USERNAME=your_username
PASSWORD=your_password
TOTP_SECRET=your_totp_secret

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.4.tar.gz (19.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.4-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tbd_api-0.0.4.tar.gz
  • Upload date:
  • Size: 19.5 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.4.tar.gz
Algorithm Hash digest
SHA256 bbf801870f786a853baf36a96916bbdc02ba04c72e1e8dc58fe05a1800b79aed
MD5 33f0eccd7490fff8d60c706f17d4dea7
BLAKE2b-256 86ee361933ab079777868c62e123a64dc9277136d094b497aaf5852d88931995

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tbd_api-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 21.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb2ffffe71779a42773c337b678f50a635e8689bcbfe0b80598cdbfe9e105d4
MD5 bad85ddfc79631b4fef1855f1b9a7726
BLAKE2b-256 c7119caf096fabf0b46f79083eaf234e254b06ebbbba5f526de7c45d27ef2381

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