关于 hacker-news-scraper
一个通过 Algolia HN Search API 搜索 Hacker News 的 Python 命令行技能。支持按日期、内容类型和关键词筛选,并按 points 排序输出 JSON 或摘要。
主要功能
- 01按查询词搜索 Hacker News
- 02按日期和内容类型筛选
- 03应用可选关键词筛选
- 04按 points 排序结果
- 05输出 JSON 或摘要
适用场景
- 01查找近期主题讨论
- 02浏览 Ask HN 或 Show HN 帖子
- 03收集符合关键词的故事
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ gooseworks-ai/ goose-skills --skill hacker-news-scraper安装后在 Claude Code 中输入/hacker-news-scraper确认已加载。
附带文件scripts/search_hn.pyskill.meta.json
详细介绍
Hacker News 抓取工具
使用免费的 Algolia HN Search API 搜索 Hacker News。无需 Apify 令牌或 API 密钥。
快速开始
唯一的依赖项:pip install requests。
# Stories about AI content marketing in last week
python3 skills/hacker-news-scraper/scripts/search_hn.py \
--query "AI content marketing" --days 7
# Show HN posts in last month (summary view)
python3 skills/hacker-news-scraper/scripts/search_hn.py \
--query "" --tags show_hn --days 30 --output summary
# Comments mentioning a specific tool
python3 skills/hacker-news-scraper/scripts/search_hn.py \
--query "LangChain" --tags comment --days 14 --max-results 20
脚本工作原理
- 查询 Algolia HN Search API(
search_by_date端点) - 使用
numericFilters=created_at_i>{unix_timestamp}在服务端按日期筛选 - 分页获取结果,直至达到结果数量上限
- 将结果规范化为统一的架构
- 应用可选的关键词筛选(客户端)
- 按积分降序排序,并输出 JSON 或摘要
CLI 参考
| 标志 | 默认值 | 描述 |
|---|---|---|
--query | 必需 | 搜索查询 |
--days | 7 | 搜索过去多少天的内容 |
--tags | story | 条目类型:story、comment、ask_hn、show_hn |
--max-results | 50 | 返回的结果数量上限 |
--keywords | 无 | 额外的筛选关键词(逗号分隔,采用 OR 逻辑) |
--output | json | 输出格式:json 或 summary |
输出格式
{
"id": "12345678",
"title": "Show HN: My new tool",
"url": "https://example.com",
"author": "username",
"points": 42,
"num_comments": 15,
"created_at": "2026-02-18T12:00:00.000Z",
"hn_url": "https://news.ycombinator.com/item?id=12345678",
"text": ""
}
费用
免费。 无需 API 密钥,没有速率限制(在合理范围内),不消耗 Apify 点数。
评论
支持 Markdown