用途:搜索 Hacker News 上的故事与评论,用于查找 HN 讨论、追踪提及或发现内容。基于免费的 Algolia HN Search API,无需 Apify token 或 API key。
主要能力:脚本查询 Algolia HN Search API 的 search_by_date 端点,使用 numericFilters=created_at_i>{unix_timestamp} 在服务端按日期过滤,分页直到达到 max-results,将结果规范化为统一结构,可选客户端关键词过滤,按 points 降序排序,输出 JSON 或摘要。
使用方式:唯一依赖为 pip install requests。示例:python3 skills/hacker-news-scraper/scripts/search_hn.py --query "AI content marketing" --days 7;python3 skills/hacker-news-scraper/scripts/search_hn.py --query "" --tags show_hn --days 30 --output summary;python3 skills/hacker-news-scraper/scripts/search_hn.py --query "LangChain" --tags comment --days 14 --max-results 20。
CLI 参数:--query(必填,搜索词)、--days(默认 7,回溯天数)、--tags(默认 story,可选 story、comment、ask_hn、show_hn)、--max-results(默认 50)、--keywords(可选,逗号分隔,OR 逻辑)、--output(默认 json,可选 json 或 summary)。
输出字段:id、title、url、author、points、num_comments、created_at、hn_url、text。
适用场景:查找 HN 讨论、追踪品牌或工具提及、发现热门内容。
限制:费用免费,无 API key、无速率限制(合理范围内)、无 Apify 积分消耗。其他限制暂未提供。