mcpField
H
hacker-news-scraper

hacker-news-scraper

github.com/gooseworks-ai数据与数据库1.3k59 次安装3 天前更新
代码仓库

关于 hacker-news-scraper

一个通过 Algolia HN Search API 搜索 Hacker News 的 Python 命令行技能。支持按日期、内容类型和关键词筛选,并按 points 排序输出 JSON 或摘要。

主要功能

  1. 01按查询词搜索 Hacker News
  2. 02按日期和内容类型筛选
  3. 03应用可选关键词筛选
  4. 04按 points 排序结果
  5. 05输出 JSON 或摘要

适用场景

  1. 01查找近期主题讨论
  2. 02浏览 Ask HN 或 Show HN 帖子
  3. 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

脚本工作原理

  1. 查询 Algolia HN Search API(search_by_date 端点)
  2. 使用 numericFilters=created_at_i>{unix_timestamp} 在服务端按日期筛选
  3. 分页获取结果,直至达到结果数量上限
  4. 将结果规范化为统一的架构
  5. 应用可选的关键词筛选(客户端)
  6. 按积分降序排序,并输出 JSON 或摘要

CLI 参考

标志默认值描述
--query必需搜索查询
--days7搜索过去多少天的内容
--tagsstory条目类型:story、comment、ask_hn、show_hn
--max-results50返回的结果数量上限
--keywords无额外的筛选关键词(逗号分隔,采用 OR 逻辑)
--outputjson输出格式: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