SuperAPI AI 工具集

hacker-news-scraper

编程与开发

查看项目

更新于 10-15 21:54

技能介绍

用途:搜索 Hacker News 上的故事和评论,用于查找 HN 讨论、追踪提及、发现内容。基于免费的 Algolia HN Search API,无需 Apify token 或 API key。

主要能力:按查询词、时间范围(--days)、内容类型(--tags:story、comment、ask_hn、show_hn)检索;限制返回数量(--max-results);附加关键词过滤(--keywords,逗号分隔,OR 逻辑);输出 JSON 或 summary 摘要。脚本流程为:查询 Algolia 的 search_by_date 端点,用 numericFilters=created_at_i>{unix_timestamp} 做服务端日期过滤,分页直到达到 max-results,规范化结果,可选客户端关键词过滤,按 points 降序排序后输出。

使用方式:唯一依赖为 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;--max-results 默认 50;--keywords 默认无;--output 默认 json。

输出字段:id、title、url、author、points、num_comments、created_at、hn_url、text。

适用场景:查找 HN 讨论、追踪品牌或工具提及、发现热门内容。

限制:费用免费,无 API key、无速率限制(合理范围内)、无 Apify 积分消耗。其他限制暂未提供。