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.5.tar.gz (20.0 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.5-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tbd_api-0.0.5.tar.gz
Algorithm Hash digest
SHA256 5bf04990541ddbc375e7c57e0ef4c3e5d1770b5e56beb1e190e45cb26eaccf8b
MD5 8045312ef939c5cb5df9cf72d60df19d
BLAKE2b-256 1156ce67782c6415a96e828bd4016d129af32b42a006c77550cc49e5361aa534

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tbd_api-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f0cbdbb89cf705346b61155ff6b9624683324862062df195716d4f3b9bdfd4d1
MD5 b3c2231e337309e8adb86ee5cf8cd770
BLAKE2b-256 6d690c067d57839c83e9a4c1ea89d471858acbbf04f73a0d55deb42ef87d226f

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