# DailyHot **Repository Path**: ooiu/dailyhot ## Basic Information - **Project Name**: DailyHot - **Description**: DailyHot | 今日热榜API,支持JSON/RSS订阅,聚合50+订阅源,采用Go语言开发,支持Redis缓存,自动更新 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: https://dailyhot.ooiu.cn - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-28 - **Last Updated**: 2026-07-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: 今日热榜, DailyHot, 聚合资讯, rss, Go语言 ## README # DailyHot API · Go 一个用 Go 写的热点资讯聚合 API。 它把不同网站的热榜整理成统一的 JSON,也能直接输出 RSS。目前接入 59 个资讯源,包括知乎、微博、哔哩哔哩、GitHub Trending等。 ## 页面预览 ![DailyHot API 接口目录](docs/images/api-home.png) ## 主要功能 - 支持 JSON 和 RSS 格式请求 - 内存缓存,可选 Redis,支持自定义 Redis 缓存时长 - 支持按配置间隔自动刷新全部资讯源 - 首页展示所有订阅源 - 轻量级,服务器稳定运行,低占用 ## 快速开始 需要 Go 1.23 或更高版本。 ```bash go run ./cmd/server ``` 打开 `http://localhost:6688` 就能看到全部接口。 配置文件在 [`config/config.yaml`](config/config.yaml)。例如每小时自动刷新一次: ```yaml update: interval: 3600 ``` 单位是秒,设为 `0` 可以关闭自动刷新。修改配置后需要重启服务。 ## 示例接口 | 地址 | 说明 | | --- | --- | | `/` | 接口首页 | | `/all` | 全部资讯源 | | `/status` | 各资讯源最近更新时间 | | `/zhihu` | 知乎热榜 | | `/weibo` | 微博热搜 | | `/aihot` | AI HOT 精选 AI 资讯 | 常用参数: ```text /{source}?limit=10 /{source}?cache=false /{source}?rss=true ``` ## 编译 Linux 版本 AMD64: ```bash CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o dailyhot-api ./cmd/server ``` ARM64: ```bash CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" -o dailyhot-api ./cmd/server ``` 运行时请在可执行文件所在目录保留 `config/config.yaml`。 ## 目录 ```text ├─ cmd/server/ 服务入口 ├─ config/config.yaml 配置文件 └─ internal/ ├─ cache/ 内存与 Redis 缓存 ├─ httpx/ HTTP 请求 ├─ server/ 路由、首页、JSON 和 RSS └─ source/ ├─ providers/ 资讯源 ├─ registry.go 注册资讯源 └─ updater.go 定时刷新 ``` 新增资讯源时,在 `internal/source/providers/` 下建立独立目录,然后加入 `registry.go` 和首页信息表,并补上测试。 ## 测试 ```bash go test ./... go vet ./... ``` ## 鸣谢 - [imsyy/DailyHotApi](https://github.com/imsyy/DailyHotApi):项目思路、接口设计和资讯源实现参考 - [DIYgod/RSSHub](https://github.com/DIYgod/RSSHub):RSS 路由与资讯源实现参考 ## 许可证 [MIT](LICENSE)