Files
RSS/README.md
T
Yuzhen e19f4bf49c
Update RSS / update (push) Successful in 5m14s
Update secrets
2026-08-29 15:11:13 +08:00

58 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RSS Merge for Gitea Actions
用一个 Python 脚本合并多个 RSS/Atom 源,并由 Gitea Actions 每 4 小时更新一次。生成结果保存在 `public/*.xml`,可以直接通过 Gitea Raw URL 订阅。
## 使用
1. 编辑 [`feeds.yml`](feeds.yml),替换示例订阅源并按需增加分组。
2. 在 Gitea 仓库的 Actions Secrets 中创建 `RSSHUB_ACCESS_KEY`,值为 RSSHub 访问密钥。
3. 将仓库推送到 Gitea。
4. 在仓库设置中启用 Actions,并确保实例上已有可用的 `act_runner`。
5. 在 Actions 页面手动运行一次 `Update RSS`,确认 `public/*.xml` 被提交。
订阅地址格式:
```text
https://git.example.com/{owner}/{repo}/raw/branch/main/public/all.xml
```
计划任务写在 [`.gitea/workflows/update.yml`](.gitea/workflows/update.yml),`0 */4 * * *` 表示按 UTC 每 4 小时运行一次。修改 `feeds.yml`、脚本或依赖也会立即触发更新。
## 配置
每个 `groups` 条目会生成一个 RSS 文件,默认路径为 `public/{分组名}.xml`:
```yaml
groups:
tech:
title: Tech News
description: My technology feeds
max_items: 100
self_url: https://git.example.com/me/rss/raw/branch/main/public/tech.xml
sources:
- https://hnrss.org/frontpage
- url: https://example.com/feed.xml
name: Optional source name
```
- `settings.allow_partial`:默认是 `true`。部分源抓取失败时,仍使用成功获取的源生成输出;一个分组的所有源都失败时才跳过该分组。
- `settings.user_agent`:默认使用 Chrome User-Agent,也可以自行替换。
- `output`:可为分组指定仓库内的相对输出路径。
凡是主机名为 `rsshub.yuzhen.pub` 的订阅源,请在 `feeds.yml` 中填写不带访问密钥的原始 URL。脚本会读取 `RSSHUB_ACCESS_KEY`,自动改用 HTTPS 并添加或替换 URL 中的 `key` 参数;密钥不会写入生成的 XML 或普通日志。其他域名不会附加该参数。
同一个 URL 被多个分组引用时只会请求一次。输出按发布时间倒序排列并截取 `max_items` 条,不进行过滤或去重。内容不变时不会重写文件,也就不会制造空提交。
## 本地运行
```bash
python -m venv .venv
python -m pip install -r requirements.txt
RSSHUB_ACCESS_KEY=your-key python merge.py
python -m unittest discover -s tests -v
```
如果配置中没有 `rsshub.yuzhen.pub`,本地运行时无需设置这个环境变量。
首次成功运行后会创建 `public/` 目录。请将生成的 XML 一并提交,后续源临时不可用时阅读器仍可访问最近一次结果。