Beta sign in

Pipe library / hn-keyword-watch

hn-keyword-watch

Recent Hacker News stories matching a keyword, from the public Algolia API.

Developer monitoring

hn.algolia.com

CLI

pipes run examples/hn-keyword-watch.pipe.yaml

MCP call

{
  "name": "pipe__hn-keyword-watch",
  "arguments": {}
}

Pipe file

examples/hn-keyword-watch.pipe.yaml

pipes: 0
name: hn-keyword-watch
version: 0.1.0
description: Recent Hacker News stories matching a keyword, from the public Algolia API.
permissions:
  network: [hn.algolia.com]
inputs:
  type: object
  properties:
    keyword:
      type: string
      minLength: 2
      default: rust
    hits:
      type: integer
      minimum: 1
      maximum: 20
      default: 8
  required: [keyword]
outputs:
  type: object
  properties:
    text: { type: string }
    count: { type: integer }
  required: [text, count]
output:
  text: "${steps.format.text}"
  count: "${steps.format.count}"
steps:
  - id: fetch
    block: fetch_http
    with:
      url: https://hn.algolia.com/api/v1/search_by_date
      query:
        query: "${inputs.keyword}"
        tags: story
        hitsPerPage: "${inputs.hits}"
      max_bytes: 500000
    retry: { max: 2, backoff_ms: 500 }
    timeout_ms: 15000
  - id: hits
    block: parse_json
    in: "${steps.fetch}"
    with:
      path: hits
  - id: shaped
    block: map
    in: "${steps.hits}"
    with:
      set:
        link: "https://news.ycombinator.com/item?id=${item.objectID}"
      pick: [objectID, title, link, created_at]
  - id: new
    block: diff_since_last
    in: "${steps.shaped}"
    with:
      key: [objectID]
      compare: [objectID]
      emit: [added]
      first_run: all
  - id: format
    block: format
    in: "${steps.new}"
    with:
      header: "Hacker News:\n"
      item_template: "- ${item.title} ${item.link}"
      separator: "\n"
  - id: print
    block: emit_stdout
    in: "${steps.format.text}"
    with: { format: text }