返回顶部
x

x-hacker-newsX黑客新闻

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.4
安全检测
已通过
156
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

x-hacker-news

x-hacker-news

获取并分析 Hacker News 内容——面向开发者、AI 研究人员和软件工程师的首选技术社区

重要提示:在使用任何 x hn 命令之前,必须先加载 x-cmd:. ~/.x-cmd.root/X



费用

[是] 免费 - 无需 API 密钥



加载 x-cmd

未安装? -> 搜索并使用 x-cmd 技能先安装 x-cmd

已安装? -> 加载 x-cmd:

bash
. ~/.x-cmd.root/X



非交互式使用

使用 x hn 进行直接的非交互式调用:

bash

获取热门故事的 JSON 数据


x hn top --json 1,10

获取特定帖子的详细信息

x hn item --json 43701153

注意: x hn 是非交互式的,适用于脚本和自动化。如需交互式浏览,请在加载 . ~/.x-cmd.root/X 后使用 x hn。



AI 与机器学习讨论

使用 x jq 过滤热门故事中的 AI/ML 主题:

bash

过滤热门故事中与 AI 相关的标题


x hn top --json 1,100 | x jq [.[] | select(.title | test(AI|artificial intelligence|machine learning|LLM|ChatGPT; i))]

过滤 LLM 和模型讨论

x hn top --json 1,100 | x jq [.[] | select(.title | test(GPT|Claude|Llama|neural|model; i))]

过滤 AI 安全与对齐讨论

x hn top --json 1,100 | x jq [.[] | select(.title | test(AI safety|alignment|AGI; i))]

编程与开发

过滤热门故事中的编程主题:

bash

过滤编程语言讨论


x hn top --json 1,100 | x jq [.[] | select(.title | test(Rust|Go|Python|TypeScript|JavaScript; i))]

过滤 Web 开发

x hn top --json 1,100 | x jq [.[] | select(.title | test(React|Vue|frontend|backend|web; i))]

过滤 DevOps 与基础设施

x hn top --json 1,100 | x jq [.[] | select(.title | test(Kubernetes|Docker|DevOps|cloud; i))]

过滤软件工程主题

x hn top --json 1,100 | x jq [.[] | select(.title | test(programming|coding|developer|software|GitHub|open source; i))]

软件工程新闻

获取软件工程与科技行业讨论:

bash

过滤创业与商业讨论


x hn top --json 1,100 | x jq [.[] | select(.title | test(startup|Y Combinator|funding|business; i))]

过滤职业与招聘主题

x hn top --json 1,100 | x jq [.[] | select(.title | test(hiring|interview|career|salary|remote; i))]

显示 Ask HN 帖子(通常涉及职业/商业讨论)

x hn ask --json 1,20

显示 Show HN 帖子(新项目/工具)

x hn show --json 1,20

故事列表

获取各种故事列表:

bash

获取热门故事(第 1-10 条)


x hn top --json 1,10

获取第 11-20 条

x hn top --json 11,20

其他类型

x hn new --json 1,10 x hn best --json 1,10 x hn ask --json 1,10 x hn show --json 1,10 x hn job --json 1,10

JSON 字段:

json
{
by: username, // 作者
descendants: 161, // 评论数
id: 47392084, // 帖子 ID
kids: [47393177, ...], // 评论 ID 列表
score: 582, // 分数/点赞数
time: 1773609736, // Unix 时间戳(秒)
title: Post Title, // 标题
type: story, // 类型(story/job 等)
url: https://... // URL
}

x jq 处理示例:

bash

提取标题和 URL


x hn top --json 1,10 | x jq -r .[] | \(.title)\t\(.url)

计算平均分数

x hn top --json 1,30 | x jq [.[].score] | add / length

按分数排序

x hn top --json 1,50 | x jq -r .[] | \(.score)\t\(.title) | sort -rn | head -10

热门域名统计

x hn top --json 1,100 | x jq -r .[].url // empty | \ sed -E s|https?://||; s|/.*|| | sort | uniq -c | sort -rn | head -10

格式化简报输出

x hn top --json 1,5 | x jq -r .[] | \n[\(.score) points] \(.title)\nAuthor: @\(.by) | Comments: \(.descendants)\n\(.url)\n

仅过滤 AI 相关故事

x hn top --json 1,100 | x jq [.[] | select(.title | test(AI|artificial intelligence|machine learning|LLM|ChatGPT; i))]

过滤编程故事

x hn top --json 1,100 | x jq [.[] | select(.title | test(programming|coding|developer|software|GitHub; i))]

帖子详情

获取特定帖子的详细信息和评论:

bash
x hn item --json

示例:

bash

获取帖子详情


x hn item --json 47392084 | x jq .[0] | {id, title, by, score, descendants, url}

获取评论 ID 列表(前 20 条)

COMMENT_IDS=$(x hn item --json 47392084 | x jq .[0].kids[:20] | .[])

获取每条评论内容(注意:每次请求需要时间)

for cid in $COMMENT_IDS; do x hn item --json $cid | x jq -r [.by, .text[0:100]] | @tsv done

注意: 评论多的帖子数据量较大,建议限制输出或分批处理。



用户信息

获取用户信息:

bash
x hn user --json

示例:

bash

获取关键用户字段(限制活跃用户的输出)


x hn user --json dang | x jq {id, created, karma, submitted: (.submitted | length)}

提取用户资料

x hn user --json dang | x jq { username: .id, created: .created, karma: .karma, about: (.about[0:200] // ) }

注意: 活跃用户的数据量较大,包含所有提交记录,可能导致超时。请使用 x jq 限制输出字段。



用户 hn-index

计算用户影响力指标:

bash
x hn hidx

输出示例:

hn-index: 42

注意: 该命令会获取用户的所有提交,对于活跃用户可能需要较长时间。



缓存

x hn 模块内置缓存功能:

bash

查看缓存配置


x hn cfg cat

默认缓存时间

- 故事数据:60 分钟

- 索引数据:30 分钟

- 缓存目录:~/.x-cmd.root/local/cache/hn/


命令参考

命令描述输出
x hn top --json N,M热门故事JSON 数组
x hn new --json N,M
最新故事 | JSON 数组 | | x hn best --json N,M | 最佳故事 | JSON 数组 | | x hn ask --json N,M | Ask HN 帖子 | JSON 数组 | | x hn show --json N,M | Show HN 帖子 | JSON 数组 | | x hn job --json

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 x-hacker-news-1776027761 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 x-hacker-news-1776027761 技能

通过命令行安装

skillhub install x-hacker-news-1776027761

下载

⬇ 下载 x-hacker-news v1.0.4(免费)

文件大小: 3.4 KB | 发布时间: 2026-4-13 12:37

v1.0.4 最新 2026-4-13 12:37
- Added explicit "requires" field in metadata, specifying that the x-cmd initialization script must be present.
- Bumped version to 1.0.4 in metadata.
- No changes to functionality or documentation content.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部