···11+# get_hey_emails
22+33+Scrapes email addresses from your [HEY](https://hey.com) account and writes them to local `.txt` files. Useful for building allowlists/blocklists in mutt or other mail clients.
44+55+## What it scrapes
66+77+| Flag | Source | Output file |
88+|---|---|---|
99+| `--screener` | Screener (approved/denied senders) | `approved_emails.txt`, `denied_emails.txt` |
1010+| `--feed` | The Feed (newsletters) | `feed_emails.txt` |
1111+| `--paper` | Paper Trail (receipts/notifications) | `paper_trail_emails.txt` |
1212+1313+No flag runs all three.
1414+1515+## Setup
1616+1717+Requires [uv](https://github.com/astral-sh/uv). Dependencies are declared in `pyproject.toml`.
1818+1919+### Get your session cookies
2020+2121+HEY uses `httponly` cookies for authentication, so you need to grab them from the browser's Network tab:
2222+2323+1. Open `https://app.hey.com/my/clearances` in your browser
2424+2. Open DevTools → Network tab, find any request to `app.hey.com`
2525+3. Run this in the DevTools Console to copy the non-httponly cookies:
2626+2727+```javascript
2828+copy(['x_user_agent','device_token'].map(name => {
2929+ const val = document.cookie.split('; ').find(c => c.startsWith(name+'='))?.split('=').slice(1).join('=') || '';
3030+ return `export HEY_${name.toUpperCase()}='${val}'`;
3131+}).join('\n'));
3232+```
3333+3434+4. For `session_token` and `_haystack_session` (httponly), copy them manually from **Request Headers → Cookie** in the Network tab.
3535+3636+Export all four:
3737+3838+```bash
3939+export HEY_X_USER_AGENT='...'
4040+export HEY_DEVICE_TOKEN='...' # long-lived (~20 years)
4141+export HEY_SESSION_TOKEN='...' # refresh after re-login
4242+export HEY_HAYSTACK_SESSION='...' # refresh periodically
4343+```
4444+4545+## Usage
4646+4747+```bash
4848+uv run get_screener_emails_from_hey.py # all
4949+uv run get_screener_emails_from_hey.py --screener
5050+uv run get_screener_emails_from_hey.py --feed
5151+uv run get_screener_emails_from_hey.py --paper
5252+```