← 返回
未分类 中文

x-hacker-news

Fetch and analyze Hacker News (HN) content - the premier tech community for developers, AI researchers, and software engineers. Use when users need: (1) HN t...
获取并分析黑客新闻(HN)内容 - 开发者、AI研究人员和软件工程师的顶级技术社区。用于以下场景:(1) HN热门话题、(2) 技术趋势分析、(3) 行业动态追踪、(4) 开发者讨论洞察
qiakai qiakai 来源
未分类 clawhub v1.0.4 1 版本 99793.8 Key: 无需
★ 0
Stars
📥 484
下载
💾 2
安装
1
版本
#latest

概述

x-hacker-news

> Fetch and analyze Hacker News content - the premier tech community for developers, AI researchers, and software engineers

IMPORTANT: Before using any x hn command, you MUST load x-cmd first: . ~/.x-cmd.root/X


Cost

[OK] Free - No API key required


Loading x-cmd

Not installed? -> Search and use the x-cmd skill to install x-cmd first

Installed? -> Load x-cmd:

. ~/.x-cmd.root/X

Non-Interactive Usage

Use x hn for direct non-interactive calls:

# Get top stories JSON data
x hn top --json 1,10

# Get specific post details
x hn item --json 43701153

Note: x hn is non-interactive, suitable for scripts and automation. For interactive browsing, use x hn after loading . ~/.x-cmd.root/X.


AI and Machine Learning Discussions

Filter top stories for AI/ML topics using x jq:

# Filter top stories for AI-related titles
x hn top --json 1,100 | x jq '[.[] | select(.title | test("AI|artificial intelligence|machine learning|LLM|ChatGPT"; "i"))]'

# Filter for LLM and model discussions
x hn top --json 1,100 | x jq '[.[] | select(.title | test("GPT|Claude|Llama|neural|model"; "i"))]'

# Filter for AI safety and alignment discussions
x hn top --json 1,100 | x jq '[.[] | select(.title | test("AI safety|alignment|AGI"; "i"))]'

Programming and Development

Filter top stories for programming topics:

# Filter for programming language discussions
x hn top --json 1,100 | x jq '[.[] | select(.title | test("Rust|Go|Python|TypeScript|JavaScript"; "i"))]'

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

# Filter for DevOps and infrastructure
x hn top --json 1,100 | x jq '[.[] | select(.title | test("Kubernetes|Docker|DevOps|cloud"; "i"))]'

# Filter for software engineering topics
x hn top --json 1,100 | x jq '[.[] | select(.title | test("programming|coding|developer|software|GitHub|open source"; "i"))]'

Software Engineering News

Get software engineering and tech industry discussions:

# Filter for startup and business discussions
x hn top --json 1,100 | x jq '[.[] | select(.title | test("startup|Y Combinator|funding|business"; "i"))]'

# Filter for career and hiring topics
x hn top --json 1,100 | x jq '[.[] | select(.title | test("hiring|interview|career|salary|remote"; "i"))]'

# Show Ask HN posts (often career/business discussions)
x hn ask --json 1,20

# Show Show HN posts (new projects/tools)
x hn show --json 1,20

Story Lists

Get various story lists:

# Get top stories (items 1-10)
x hn top --json 1,10

# Get items 11-20
x hn top --json 11,20

# Other types
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 Fields:

{
  "by": "username",           // Author
  "descendants": 161,         // Comment count
  "id": 47392084,             // Post ID
  "kids": [47393177, ...],    // Comment ID list
  "score": 582,               // Points/upvotes
  "time": 1773609736,         // Unix timestamp (seconds)
  "title": "Post Title",      // Title
  "type": "story",            // Type (story/job/etc)
  "url": "https://..."        // URL
}

x jq Processing Examples:

# Extract title and URL
x hn top --json 1,10 | x jq -r '.[] | "\(.title)\t\(.url)"'

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

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

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

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

# Filter for AI-related stories only
x hn top --json 1,100 | x jq '[.[] | select(.title | test("AI|artificial intelligence|machine learning|LLM|ChatGPT"; "i"))]'

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

Post Details

Get specific post details and comments:

x hn item --json <id>

Examples:

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

# Get comment ID list (first 20)
COMMENT_IDS=$(x hn item --json 47392084 | x jq '.[0].kids[:20] | .[]')

# Fetch each comment content (note: each item request takes time)
for cid in $COMMENT_IDS; do
    x hn item --json "$cid" | x jq -r '[.by, .text[0:100]] | @tsv'
done

Note: Posts with many comments have large data size, consider limiting output or batch processing.


User Info

Get user information:

x hn user --json <username>

Examples:

# Get key user fields (limit output for active users)
x hn user --json dang | x jq '{id, created, karma, submitted: (.submitted | length)}'

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

Note: Active users have large data including all submission records, which may cause timeouts. Use x jq to limit output fields.


User hn-index

Calculate user influence metric:

x hn hidx <username>

Output Example:

hn-index: 42

Note: This command fetches all user submissions and may take time for active users.


Caching

x hn module has built-in caching:

# View cache config
x hn cfg cat

# Default cache times
# - Story data: 60 minutes
# - Index data: 30 minutes
# - Cache dir: ~/.x-cmd.root/local/cache/hn/

Command Reference

CommandDescriptionOutput
------------------------------
x hn top --json N,MTop storiesJSON array
x hn new --json N,MNew storiesJSON array
x hn best --json N,MBest storiesJSON array
x hn ask --json N,MAsk HN postsJSON array
x hn show --json N,MShow HN postsJSON array
x hn job --json N,MJob postingsJSON array
x hn item --json Post detailsJSON object
x hn user --json User infoJSON object
x hn hidx hn-indexPlain text

Dependencies

  • x-cmd (required): provides hn module
  • x jq (optional): JSON processing via x-cmd

More: https://x-cmd.com/llms.txt

Entrance for AI agents.

版本历史

共 1 个版本

  • v1.0.4 当前
    2026-03-31 05:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

professional

All-Market Financial Data Hub

financial-ai-analyst
基于东方财富数据库,支持自然语言查询金融数据,覆盖A股、港股、美股、基金、债券等资产,提供实时行情、公司信息、估值、财务报表等,适用于投资研究、交易复盘、市场监控、行业分析、信用研究、财报审计、资产配置等场景,满足机构与个人需求。返回结果为
★ 122 📥 41,479
data-analysis

Hacker new

qiakai
Fetch and analyze Hacker News (HN) content - the premier tech community for developers, AI researchers, and software eng
★ 0 📥 477
professional

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 277 📥 57,503