展示 HN:我用 Zig 构建了一个快速的 RSS 阅读器
Show HN: I built a fast RSS reader in Zig

原始链接: https://github.com/superstarryeyes/hys

## Hys:一款快速、易读的 RSS 阅读器 Hys 是一款用 Zig 语言构建的超快速 RSS 阅读器,旨在提供“每日摘要”体验,对抗无休止的浏览。它优先考虑速度——启动速度极快,解析订阅源迅速——同时通过提取限制来减少无尽的滚动。 主要功能包括:**OPML 支持**,方便订阅的导入/导出;**多语言支持**;以及**订阅源分组**,用于组织管理。Hys 通过集成的**分页器 (TUI)** 提供无干扰的阅读体验,具有 Vim 风格的键绑定和内置**搜索**功能。它支持 **RSS 2.0 和 Atom 1.0** 订阅源,并利用 **OSC 8 超链接** 实现直接浏览器访问(但 Apple Terminal 的兼容性需要配置)。 安装可以通过 Homebrew (macOS) 或从源代码构建来完成。配置通过 JSON 文件 (~/.hys/config.json) 管理,允许自定义显示选项和历史记录保留。Hys 正在积极开发中,欢迎贡献——加入 Discord 社区以获取支持和协作!

## 用 Zig 编写的快速、极简 RSS 阅读器 一位开发者使用 Zig 编程语言构建了一个快速的 RSS 阅读器,优先考虑“数字极简主义”方法。与典型的阅读器不同,它每天只获取一次新文章,旨在复制传统报纸的体验——读一次,然后断开连接。 为了高效处理潜在的数百个订阅源,该阅读器利用 `curl multi` 进行 HTTP/2 多路复用和条件 GET 请求,以最大限度地减少数据传输。解析由工作线程处理,使用 Zig 的内存模型和 ArenaAllocators 进行高效的内存管理,即使处理大型 XML 订阅源也是如此。 独特的是,UI 将输出管道传输到系统的 `less` 命令,提供 Vim 风格的导航和可点击的超链接,而无需专门的 TUI 框架。该项目还包括 OPML 导入/导出和订阅源分组。 开发者希望 MIT 许可证能够鼓励更广泛的应用,并为 RSS 作为一种更平静的替代方案,推动其复兴,以对抗以参与度为导向的平台。代码可在 GitHub 上获取,并呼吁贡献和建议。
相关文章

原文

Feature Description
🧠 Doomscroll-Free Designed as a "Daily Digest." Enforces a fetch limit to help you stay informed without the infinite scroll.
⚡ Blazing Fast Built with Zig. Starts in milliseconds and parses hundreds of items in seconds.
🔗 Open Links OSC 8 hyperlink support to open articles in your default browser from URLs and links.
🔌 OPML Ready Import your existing subscriptions from any standard RSS reader or export your feeds effortlessly.
🌍 Multilingual Support Native support for Chinese, Japanese, Korean, Indic, Cyrillic etc.
📁 Feed Groups Organize your feeds into groups (e.g. tech, science, art) and read them individually or all at once.
📖 Pager TUI Automatically pipes into less for a distraction-free reading experience with intuitive vim-style keybindings.
🔎 Search Find text in your feeds with the search functionality integrated into less.
📰 Universal Feed Support RSS 2.0 and Atom 1.0 with robust parsing, HTML entity decoding, and UTF-8 validation

# 1. Install Hys with Homebrew
brew tap superstarryeyes/tap
brew install hys

# 2. Add your first feed
hys --sub "https://news.ycombinator.com/rss"

# 3. Start reading
hys

  • Zig 0.15.2: For building from source. Install instructions
  • libcurl: Robust HTTP/2 and TLS support. Install via your package manager:
    • macOS: Pre-installed (no action needed)
    • Ubuntu/Debian: sudo apt-get install libcurl4-openssl-dev
    • Fedora: sudo dnf install libcurl-devel
    • Arch: sudo pacman -S curl
    • Windows: choco install curl (using Chocolatey) or vcpkg install curl:x64-windows
  1. Clone the repository:

    git clone https://github.com/superstarryeyes/hys.git
    cd hys
  2. Build and Install:

    # Install to ~/.local/bin (make sure it's in your PATH)
    zig build -Doptimize=ReleaseSafe install -p ~/.local

# Add a feed to your main group
hys --sub "https://site.com/feed"

# Add a feed to a specific group
hys tech --sub "https://site.com/feed"

# Read the main group
hys

# Read a specific group
hys tech

# Read multiple groups combined
hys tech,science,art

# Read all groups at once
hys --all

# One-off read of a URL (doesn't save to config)
hys https://example.com/rss.xml
Action Command
Subscribe to a feed (title optional) hys --sub "https://site.com/feed" "Title"
Import OPML into main group hys --import ~/downloads/feeds.opml
Export main group's feeds (OPML) hys --export backup.opml
Set display name for a group hys <group> --name "Pretty Name"
List all groups hys --groups
Action Command
Read from all groups hys --all
View previous days' fetches hys --day 1 or hys --day 2
Reset today's daily limiter hys --reset
Action Command
Show config file path hys --config
Force-enable pager hys --pager
Disable pager for this run hys --no-pager

When Hys opens in your system pager (less), these keys are available:

  • Line-by-line

    • j or Down: Scroll down one line
    • k or Up: Scroll up one line
    • Enter: Scroll down one line
    • y: Scroll up one line
  • Paging

    • Space or f or PageDown: Page down one screen
    • b or PageUp: Page up one screen
    • d: Half-page down
    • u: Half-page up
  • Jumps

    • g: Jump to top
    • G: Jump to bottom
  • Search

    • /text: Search forward
    • ?text: Search backward
    • n: Next match
    • N: Previous match
  • Misc

    • h: Show help for all less commands
    • q: Exit back to terminal

Hys creates a JSON configuration file at ~/.hys/config.json on first run.

{
  "display": {
    "maxTitleLength": 120,
    "maxDescriptionLength": 300,
    "maxItemsPerFeed": 20,
    "showPublishDate": true,
    "showDescription": true,
    "showLink": true,
    "truncateUrls": true,
    "pagerMode": true,
    "underlineUrls": true,
    "dateFormat": "%Y-%m-%d"
  },
  "history": {
    "retentionDays": 50,
    "fetchIntervalDays": 1,
    "dayStartHour": 0
  },
  "network": {
    "maxFeedSizeMB": 0.2
  }
}

Note

Apple's default Terminal does not support OSC 8 hyperlinks. If you're using Apple Terminal, you need to set truncateUrls to false in your config. For a better experience, consider using a terminal that supports OSC 8 hyperlinks, such as Ghostty, Wezterm, Kitty, or iTerm2.

Feeds are stored in JSON files within ~/.hys/feeds/. Each group has its own file corresponding to its name (e.g., main is stored in ~/.hys/feeds/main.json).

To remove or edit a feed:

  1. Open the group's JSON file (e.g., ~/.hys/feeds/main.json).
  2. Locate the feed object within the feeds array.
  3. Delete the object to unsubscribe, or edit fields like xmlUrl or text.
  4. Save the file.

Contributions are welcome! Please feel free to submit a Pull Request.

Join our Discord community for discussions, support and collaboration.

Join our Discord


This project is licensed under the MIT License. See the LICENSE file for details.


⭐ Star this repo if you find it useful!

联系我们 contact @ memedata.com