← All one-liners·#002·discovery·self contained·beginner

Full-text search HN by keyword

HN's Algolia API gives you 10 years of indexed posts in 250ms. No auth, no rate limit for sensible use.

The one-liner
$ curl -s "https://hn.algolia.com/api/v1/search?query=claude+code&tags=story&hitsPerPage=20" \
  | jq -r '.hits[] | "[\(.points // 0)↑ \(.num_comments // 0)💬] \(.title) — \(.url // "hn://" + (.objectID))"'
What each stage does
  1. [01] curlcurl -s "https://hn.algolia.com/api/v1/search?query=claude+code&tags=story&hitsP…
    Algolia full-text search. URL-encoded query, tags=story restricts to stories (vs comments/poll), 20 hits per page.
  2. [02] jqjq -r '.hits[] | "[\(.points // 0)↑ \(.num_comments // 0)💬] \(.title) — \(.url …
    Walk the .hits array; render each as a one-liner with score, comment count, title, and URL (falling back to a synthetic hn:// link for selfposts).
Expected output (sample)
[523↑ 142💬] Claude Code now ships with --bare for clean pipes — https://...
[412↑ 89💬] Why I switched from claude.ai to Claude Code — https://...
...
Caveats & tips
  • Replace 'claude+code' with any URL-encoded query. Spaces = +.
  • Algolia also supports tags=comment, tags=ask_hn, tags=show_hn, tags=launch_hn, and date ranges via numericFilters.