Torrent Downloader
Search magnet links for movies and TV shows, auto-rank by quality, and push to qBittorrent for download.
Prerequisites
- qBittorrent with Web UI enabled (default:
http://localhost:8080) - Python 3 (no extra packages needed — uses only stdlib)
Configuration
Set these environment variables (or edit the scripts directly):
| Variable | Default | Description |
|---|---|---|
QBT_URL | http://localhost:8080 | qBittorrent Web UI URL |
QBT_USER | admin | qBittorrent username |
QBT_PASS | adminadmin | qBittorrent password |
Workflow
- Search magnet links using keyword
- Auto-score results (built-in Chinese subtitles > external subs; 1080P/4K preferred)
- Pick the best result and push to qBittorrent
- Report download status to user
Search
python3 {baseDir}/scripts/search_magnet.py "keyword" [--prefer-4k] [--limit N]
- Default preference: 1080P. Add
--prefer-4kfor 4K priority. - Scoring: built-in Chinese subtitles (+100) > external subtitles (+50); 4K (+80/40) > 1080P (+60/30)
- Output: JSON with
results[].magnet,results[].title,results[].score
Download
python3 {baseDir}/scripts/qbt_download.py "<magnet_url>" [--category CATEGORY]
Check Download Status
python3 {baseDir}/scripts/qbt_download.py --status
Agent Behavior Rules
- After search, pick the highest-scored result and start download — don't show the search list to user
- After download starts, tell user: title, file size, resolution info
- If no results found, retry with English title
- Honor user's resolution preference when specified