ti-hnparse
@eph5xx · 收录于 1 周前
Python scripts for fetching a single HN post (hnparse.py) and searching HN posts via Algolia (hnsearch.py)
适合你,如果需要从 Hacker News 获取或搜索帖子数据。
/ 下载安装
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code
~/.claude/skills/(项目级 .claude/skills/)Codex CLI
~/.codex/skills/Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add eph5xx/tweakidea/ti-hnparse/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- eph5xx/tweakidea/ti-hnparse/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify eph5xx/tweakidea/ti-hnparse安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
42GitHub stars
~460最小装载
~3.2K含声明引用
~3.2K文本包总量
镜像托管
怎么用
技能原文 SKILL.md
Contains two standalone Python scripts that talk to the free Algolia Hacker News API:
hnparse.py— fetch one HN post (article + full comment tree) and write structured markdown.hnsearch.py— search/list HN posts by query and time range; emits JSON to stdout.
hnparse.py usage
uv run <path-to>/hnparse.py <hn-url-or-id> [-o <output-directory>]
- Uses
uv runinline script metadata for dependencies (playwright, httpx, trafilatura) - Fetches post metadata and comment tree from Algolia HN API
- Extracts linked article via Playwright headless browser (falls back to plain HTTP)
- Writes
content.mdto the output directory - Default output:
~/.tweakidea/hn/hn-{item_id}/content.md - Prints the absolute path of the output file to stdout (last line)
- All progress messages go to stderr
For better article extraction from JS-heavy sites, run uv run playwright install chromium once. Without it, the script falls back to plain HTTP which works fine for most sites.
hnsearch.py usage
uv run <path-to>/hnsearch.py --query "<freeform>" --days <N> \ [--tags story|show_hn|ask_hn|front_page|poll] \ [--min-points N] [--limit N]
- Single dependency:
httpx(no Playwright / trafilatura needed) - Queries
https://hn.algolia.com/api/v1/search(popularity-sorted) --queryrequired;--daysrequired (0= no time filter / all-time)--tagsdefaults tostory(excludes comments); allowed:story,show_hn,ask_hn,front_page,poll; multiple tags comma-separated--min-pointsdefaults to10;--limitdefaults to20(max50)- Prints a JSON array of hits to stdout. Each hit has:
id,title,url,points,num_comments,author,created_at_i,relative_age,hn_url. - Progress and errors go to stderr. Exits non-zero on HTTP failure.
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →
评论
登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。
…