<div align="center">

# cutshort-cli

**Search Cutshort jobs from your terminal — no API key, no third-party dependencies.**

[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](#)
[![live](https://img.shields.io/badge/status-working-brightgreen)](#)

</div>

`cutshort-cli` is a small, dependency-free command-line tool for searching Cutshort
jobs and reading full job descriptions from the terminal. It needs **no API key** —
it reads the same server-rendered data (`__NEXT_DATA__`) that Cutshort's own pages
ship to the browser, so the public commands work with zero setup. A single extra
command (`whoami`) uses a session-cookie file for your own authenticated profile.

Only the Python standard library — no `requests`, no `httpx`, nothing to `pip install`
beyond the package itself.

---

## Features

- 🔍 **`search`** — keyword search with optional location filter, paging, and JSON output
- 📄 **`job`** — pull a complete, human-readable job description from any job URL
- 👤 **`whoami`** — view your authenticated Cutshort profile (from a session cookie file)
- 🧩 **no dependencies** — runs on a stock Python 3.9+ install
- 🛡️ **built-in retry/backoff** on transient network errors

## Install

```bash
pip install git+https://github.com/kragent66-glitch/cutshort-cli.git
```

or, from a checkout:

```bash
pip install -e .
```

No Python? Run it without installing:

```bash
git clone https://github.com/kragent66-glitch/cutshort-cli.git
python3 cutshort-cli/src/cutshort/__main__.py search "ai engineer"
```

## Usage

### Search jobs

```bash
cutshort search "AI engineer"
cutshort search "LangChain engineer" --loc Mumbai
cutshort search "ML" --page 2 --limit 20
cutshort search "backend" --loc "Pune" --json   # machine-readable
```

### Read one job

```bash
cutshort job https://cutshort.io/job/Senior-Machine-Learning-Engineer-... 
cutshort job "Senior-Machine-Learning-Engineer-...-"    # path fragment also works
cutshort job <url> --json
```

### Your profile (needs cookies)

Export a Cutshort session via the Cookie-Editor browser extension as JSON and save it:

```bash
mkdir -p ~/.config/cutshort
# paste Cookie-Editor JSON export here:
#   ~/.config/cutshort/cookies.json        (default)
#   or point at it with the env var:
export CUTSHORT_COOKIES=/path/to/cookies.json

cutshort whoami
cutshort whoami --json
```

> 🗝️ Cookies let the tool act as *you*, so treat them like a password. Keep the file
> out of version control (both our default path and the `.gitignore` are set up for it).

## How it works

Cutshort is a Next.js app. Every search and job page embeds its own rendered data in
a `__NEXT_DATA__` script tag before hitting your browser. `cutshort-cli` fetches that
tag and parses it directly — the public commands never touch an authenticated API and
need no login. `whoami` is the exception: it calls the authenticated `/api/auth/user`
endpoint using your session cookies.

## Why there's no `apply` command

This is deliberate. Cutshort gates applications behind a multi-step candidate-data
wizard and a Cloudflare Turnstile captcha — explicitly anti-bulk, and by design there is
**no clean HTTP endpoint** to programmatically submit an application. This tool is built
to *shortlist and evaluate* fast (search + full JD), so you can apply to a one-click
"Apply now" yourself. Respecting that boundary is also what keeps your account safe.

## Tests

```bash
python -m unittest discover -s tests -v
```

Parsers are covered with real, trimmed Cutshort payloads in `tests/fixtures/` —
no network needed.

## License

MIT. Free to use, fork, and build on.

---

Built for engineers who evaluate jobs fast. **Unofficial** — not affiliated with or
endorsed by Cutshort. Questions, ideas, or want this run for you? Email
[kragent66@gmail.com](mailto:kragent66@gmail.com).