hacker-news-poster

TotalClaw 作者 totalclaw

在 Hacker News 上发帖、评论和互动。当用户要求提交显示 HN、发布故事、评论 HN 线程、编辑评论或更新 HN 个人资料时使用。需要 HN_USERNAME 和 HN_PASSWORD 环境变量。将会话cookie保留到~/.hn_cookies.txt(可通过HN_COOKIE_FILE环境变量进行配置)。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~saikatkumardey-hacker-news-poster
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~saikatkumardey-hacker-news-poster/file -o saikatkumardey-hacker-news-poster.md
## 概述(中文)

在 Hacker News 上发帖、评论和互动。当用户要求提交显示 HN、发布故事、评论 HN 线程、编辑评论或更新 HN 个人资料时使用。需要 HN_USERNAME 和 HN_PASSWORD 环境变量。将会话cookie保留到~/.hn_cookies.txt(可通过HN_COOKIE_FILE环境变量进行配置)。

## 原文

# Hacker News Poster

Submit stories, comment on threads, edit comments, and update profiles on Hacker News.

## Setup

### Required Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `HN_USERNAME` | Yes | Hacker News username |
| `HN_PASSWORD` | Yes | Hacker News password |
| `HN_COOKIE_FILE` | No | Cookie storage path (defaults to `~/.hn_cookies.txt`) |

### Security Note

Session cookies are stored in plaintext at `HN_COOKIE_FILE` (or `~/.hn_cookies.txt`). These are standard HN session tokens. Delete the file to clear the session.

## CLI

All commands go through `scripts/hn.py`. Always `login` first per session.

```bash
# login (reads HN_USERNAME/HN_PASSWORD from env)
python3 scripts/hn.py login

# submit a link post
python3 scripts/hn.py submit --title "Show HN: My Tool" --url "https://example.com"

# submit a text post (Ask HN, etc.)
python3 scripts/hn.py submit --title "Ask HN: Question?" --text "body text here"

# comment on a story or reply to a comment
python3 scripts/hn.py comment --parent 12345678 --text "your comment"

# edit a comment (only within HN's edit window)
python3 scripts/hn.py edit --id 12345678 --text "updated comment"

# update profile about section
python3 scripts/hn.py profile --username youruser --about "your bio"
```

All commands output JSON on success (`{"ok": true, ...}`) and print errors to stderr.

## Notes

- HN rate-limits submissions and comments. If you get a rate limit error, wait a few minutes.
- Comments can only be edited within ~2 hours of posting.
- The `submit` command returns the new item id and url on success.
- Session cookies are stored in `~/.hn_cookies.txt` to avoid re-authenticating on every command. Delete this file to clear the session.
- For reading HN (search, top stories, comments), use the existing `hacker-news` skill or the HN API directly. This skill is write-only.

## Combining with the read-only HN skill

1. use the `hacker-news` skill to browse/search stories and find interesting threads
2. use this skill to login and post/comment