Metadata-Version: 2.4
Name: nexusphp-cli
Version: 0.1.0
Summary: Read NexusPHP private-tracker torrents from the terminal as Markdown or JSON.
Project-URL: Homepage, https://github.com/rumisle/nexus-cli
Project-URL: Repository, https://github.com/rumisle/nexus-cli
Project-URL: Issues, https://github.com/rumisle/nexus-cli/issues
Author: rumisle
License-Expression: MIT
License-File: LICENSE
Keywords: cli,nexusphp,private-tracker,pt,scraper,torrent
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: lxml>=5.0
Requires-Dist: requests>=2.31
Description-Content-Type: text/markdown

# nexus-cli

Read [NexusPHP](https://github.com/xiaomlove/nexusphp) private-tracker torrents
from the terminal as Markdown (default) or JSON.

There is no official NexusPHP data API — this scrapes the server-rendered
`torrents.php` / `details.php` pages using your logged-in session cookie, and
uses your `passkey` (auto-discovered from any page) for `.torrent` downloads.

## Install

```bash
uv tool install nexusphp-cli   # or: pipx install nexusphp-cli
```

The installed command is `nexusphp`. From a checkout you can also run it with
`uv run nexusphp ...`.

## Auth

Grab the `access_token` cookie value from your browser (DevTools → Application →
Cookies) and export it together with the site URL:

```bash
export NEXUS_BASE='https://your-tracker.example'   # required (or pass --base)
export NEXUS_TOKEN='eyJ0eXAiOiJKV1Qi...'           # required (or pass --token)
export NEXUS_PASSKEY='...'                          # optional, auto-discovered
```

## Usage

```bash
uv run nexusphp search "人生切割术"                 # Markdown list
uv run nexusphp search "人生切割术" --json          # JSON
uv run nexusphp search "severance" --cat tv,anime --incldead 1
uv run nexusphp search "office" --area subtitle --mode exact
uv run nexusphp details 472747                     # single torrent
uv run nexusphp details 472747 --json
uv run nexusphp url 472747                          # print download URL (incl. passkey)
uv run nexusphp download 472747 -o sev.torrent      # save the .torrent file
```

Or install it as a tool:

```bash
uv tool install .
nexusphp search "无职转生" -j | jq '.torrents[] | {id, title, seeders, size}'
```

## Commands

| Command | Description |
|---------|-------------|
| `search <query>` | Search torrents. `--area title/subtitle/uploader/imdb/douban`, `--mode and/or/exact`, `--cat`, `--incldead 0/1/2`, `-p/--page` (0-indexed) |
| `details <id>` | Torrent detail page (name, size, subtitle, imdb, ...) |
| `url <id>` | Print the `download.php` URL including your passkey (nothing is saved) |
| `download <id>` | Fetch that URL and save the `.torrent` file (`-o` for filename) |

Global: `--base`, `--token`, `-j/--json`.

## Categories

`movie tv show doc anime music mv sport software game material misc mobile`
(or pass numeric NexusPHP cat ids). Comma-separate for multiple.
