Skip to content

collectivewinca/hacker-feeds-cli

Repository files navigation

📰 hacker-feeds-cli

A command line tool for Hacker NewsProduct HuntGitHub TrendingReddit and V2EX feeds.

Usage

# install
> npm install -g hacker-feeds-cli
# command option
> hfeeds help
# hf for short
> hf news
# JSON output (for automation/chat paste)
> hf --json github -s daily -l javascript
# config cli
> hf config
# optional: set Product Hunt token
> hf config --ph-token <token>
# optional: use env var instead
> export HF_PRODUCTHUNT_TOKEN=<token>

Local Checks

npm test
npm run smoke
npm run smoke:live

JSON Output

Use --json before any sub command:

hf --json github -s daily -l javascript
hf --json news -t 5
hf --json reddit -t popular -s top

To send in chat, paste output inside a fenced block:

{ "source": "github", "items": [] }

feeds-cli-6

Resource Support

Because most of the web servers are located abroad, please make sure your network can access the above website properly. You can try pinging the following domains.

ping github.com
ping www.v2ex.com
ping hacker-news.firebaseio.com
ping api.producthunt.com
ping www.reddit.com
Resource Sub Command Parameters Screenshot
GitHub github -l, --lang
-s, --since
image-20210530161456461
Product Hunt product -c, --count
-p, --past
image-20210530163127103
Hacker News news -t --top image-20210530163347458
Reddit reddit -t --topic
-s --sort
CUAGzP
V2EX v2ex -n --node neAWcA

Product Hunt Setup

The Product Hunt feed requires a free API token (the other four feeds work without any key).

  1. Visit api.producthunt.com/v2/oauth/applications
  2. Sign in and click Add an Application
  3. Set any name and https://localhost as the redirect URI
  4. Open the app and generate a Developer Token

Then configure the CLI:

# Option A: environment variable (add to .bashrc / .zshrc to persist)
export HF_PRODUCTHUNT_TOKEN="your-token"

# Option B: CLI config (saved to ~/.hacker-feeds-cli/config.json)
hf config --ph-token your-token

Verify it works:

hf product -c 3
# or in JSON mode
hf --json product -c 3

Language Support

Input sub-command config to config cli language.

> hf config
? Please select a language(Default EN):  (Use arrow keys)
  EN(English)
❯ ZH(简体中文)

feeds-cli-7

TODO

  • i18n support
  • Accept resouce param
  • Hyper link support
  • Support Translate
  • Add more resource

API References

About

CLI for GitHub Trending, Hacker News, Reddit, Product Hunt & V2EX feeds. Fork with JSON mode, retries, input validation, and OpenClaw skill.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors