Skip to content

awpetrik/yts-dl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yts-dl

Language: English Bahasa Indonesia

Python 3.10+ Click Rich Requests TOML

Interactive terminal movie downloader powered by the YTS API. It supports local torrent clients, remote qBittorrent, and clipboard export with a clean Rich-based UI.


English

Overview

yts-dl is a Python CLI app for searching and selecting movies from YTS, then sending the magnet link to your preferred destination:

  • Local torrent client (macOS/Linux/Windows)
  • Remote qBittorrent (homelab/server)
  • Clipboard (copy magnet link)

Features

  • Interactive main menu with guided prompts
  • Movie discovery commands:
    • search by title
    • top by rating
    • trending by latest additions
  • Torrent quality picker (720p, 1080p, 1080p.x265, 2160p, 3D)
  • Global behavior overrides: --local, --remote, --quality
  • Remote setup wizard with qBittorrent connection test
  • Error handling for API/network failures with retry prompts

Requirements

  • Python 3.10+
  • Dependencies:
    • click
    • rich
    • requests
    • tomllib (builtin on Python 3.11+) or tomli fallback

Installation

Run directly without installation:

python main.py

Or install in editable mode:

python -m pip install -e .

Then use:

yts-dl

If your shell cannot find the command, run it from your virtual environment:

.venv/bin/yts-dl

Configuration

Config file location:

~/.config/yts-dl/config.toml

Example:

[local]
default_mode = "local" # "local" or "remote"

[remote]
host = "http://192.168.1.x:8080"
username = "admin"
password = ""
save_path = "/mnt/storage/movies"

Setup wizard:

yts-dl config setup

Show current configuration:

yts-dl config show

Remote example (qBittorrent-nox):

If you run qBittorrent in headless mode (qbittorrent-nox), Web UI usually listens on port 8080.

  • Example host: http://192.168.1.20:8080
  • Login endpoint used by this app: /api/v2/auth/login
  • Add torrent endpoint used by this app: /api/v2/torrents/add

Typical setup flow:

  1. Install and run qbittorrent-nox on your server.
  2. Enable Web UI and set username/password.
  3. Make sure port 8080 is reachable from your machine.
  4. Set host, username, password, and save_path in config.toml (or use yts-dl config setup).

Usage

Main interactive menu:

yts-dl

Commands:

yts-dl search [QUERY]
yts-dl top [--genre GENRE] [--min-rating FLOAT] [--quality QUALITY]
yts-dl trending [--quality QUALITY]
yts-dl config setup
yts-dl config show

Global flags:

--remote              # force remote qBittorrent destination
--local               # force local torrent client destination
--quality             # 720p | 1080p | 1080p.x265 | 2160p | 3D
--save-path PATH      # override save directory on remote server

Examples:

yts-dl search inception --quality 1080p --remote
yts-dl top --genre action --min-rating 7.5
yts-dl trending --local

Project Structure

yts-dl/
├── main.py              # CLI entrypoint and interactive flows
├── api.py               # YTS API integration
├── qbit.py              # qBittorrent Web API client
├── config.py            # Config load/save and setup wizard
├── ui.py                # Rich UI helpers (tables, panels, spinner)
├── utils.py             # Magnet builder, local open, clipboard helpers
├── requirements.txt
└── pyproject.toml

Operational Notes

  • If --remote is used and config does not exist yet, setup wizard is prompted.
  • If remote qBittorrent is unreachable, the app can offer a local fallback.
  • If clipboard tools are unavailable, magnet link is printed as fallback.
  • Press Ctrl+C anytime to exit safely.

Troubleshooting

  • command not found: yts-dl
    • Activate your environment or run .venv/bin/yts-dl.
  • qBittorrent connection failure
    • Verify host URL, credentials, port, and network access.
  • No search results
    • Try broader keywords or remove quality constraints.

Disclaimer

Use this software responsibly and in compliance with applicable laws in your region. You are solely responsible for the content you access or download.


Bahasa Indonesia

Ringkasan

yts-dl adalah aplikasi CLI Python untuk mencari film dari YTS lalu mengirim magnet link ke tujuan yang diinginkan:

  • Torrent client lokal (macOS/Linux/Windows)
  • qBittorrent remote (homelab/server)
  • Clipboard (salin magnet link)

Fitur

  • Menu interaktif utama dengan prompt terarah
  • Perintah pencarian film:
    • search berdasarkan judul
    • top berdasarkan rating
    • trending berdasarkan film terbaru
  • Pemilih kualitas torrent (720p, 1080p, 1080p.x265, 2160p, 3D)
  • Override perilaku global: --local, --remote, --quality
  • Setup wizard remote dengan tes koneksi qBittorrent
  • Penanganan error API/jaringan dengan opsi retry

Persyaratan

  • Python 3.10+
  • Dependensi:
    • click
    • rich
    • requests
    • tomllib (builtin Python 3.11+) atau fallback tomli

Instalasi

Jalankan langsung tanpa instalasi package:

python main.py

Atau install editable (disarankan untuk development):

python -m pip install -e .

Lalu jalankan:

yts-dl

Jika command tidak ditemukan oleh shell, jalankan dari virtualenv:

.venv/bin/yts-dl

Konfigurasi

Lokasi file konfigurasi:

~/.config/yts-dl/config.toml

Contoh:

[local]
default_mode = "local" # "local" atau "remote"

[remote]
host = "http://192.168.1.x:8080"
username = "admin"
password = ""
save_path = "/mnt/storage/movies"

Setup wizard:

yts-dl config setup

Tampilkan konfigurasi aktif:

yts-dl config show

Contoh remote (qBittorrent-nox):

Jika Anda menjalankan qBittorrent mode headless (qbittorrent-nox), biasanya Web UI aktif di port 8080.

  • Contoh host: http://192.168.1.20:8080
  • Endpoint login yang dipakai aplikasi ini: /api/v2/auth/login
  • Endpoint tambah torrent yang dipakai aplikasi ini: /api/v2/torrents/add

Alur setup yang umum:

  1. Install dan jalankan qbittorrent-nox di server.
  2. Aktifkan Web UI lalu atur username/password.
  3. Pastikan port 8080 bisa diakses dari mesin Anda.
  4. Isi host, username, password, dan save_path di config.toml (atau pakai yts-dl config setup).

Penggunaan

Menu interaktif utama:

yts-dl

Perintah:

yts-dl search [QUERY]
yts-dl top [--genre GENRE] [--min-rating FLOAT] [--quality QUALITY]
yts-dl trending [--quality QUALITY]
yts-dl config setup
yts-dl config show

Flag global:

--remote              # paksa tujuan remote qBittorrent
--local               # paksa tujuan torrent client lokal
--quality             # 720p | 1080p | 1080p.x265 | 2160p | 3D
--save-path PATH      # override direktori simpan di server remote

Contoh:

yts-dl search inception --quality 1080p --remote
yts-dl top --genre action --min-rating 7.5
yts-dl trending --local

Struktur Proyek

yts-dl/
├── main.py              # Entry point CLI dan alur interaktif
├── api.py               # Integrasi YTS API
├── qbit.py              # Client qBittorrent Web API
├── config.py            # Load/save config dan setup wizard
├── ui.py                # Helper Rich (table, panel, spinner)
├── utils.py             # Builder magnet, buka lokal, helper clipboard
├── requirements.txt
└── pyproject.toml

Catatan Operasional

  • Jika --remote dipakai dan config belum ada, setup wizard akan ditawarkan.
  • Jika qBittorrent remote tidak bisa dihubungi, aplikasi bisa menawarkan fallback ke lokal.
  • Jika utilitas clipboard tidak tersedia, magnet link akan ditampilkan sebagai fallback.
  • Tekan Ctrl+C kapan saja untuk keluar dengan aman.

Troubleshooting

  • command not found: yts-dl
    • Aktifkan environment atau jalankan .venv/bin/yts-dl.
  • Gagal koneksi qBittorrent
    • Periksa host URL, kredensial, port, dan akses jaringan.
  • Hasil pencarian kosong
    • Coba kata kunci yang lebih umum atau hilangkan filter kualitas.

Disclaimer

Gunakan aplikasi ini secara bertanggung jawab dan sesuai hukum yang berlaku di wilayah Anda. Anda bertanggung jawab penuh atas konten yang diakses atau diunduh.

About

YTS CLI Downloader

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages