Initial commit
Update RSS / update (push) Failing after 6m21s

This commit is contained in:
2026-08-29 09:36:20 +08:00
commit 9f9f973f08
7 changed files with 575 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
# RSS Merge for Gitea Actions
用一个 Python 脚本合并多个 RSS/Atom 源,并由 Gitea Actions 每 4 小时更新一次。生成结果保存在 `public/*.xml`,可以直接通过 Gitea Raw URL 订阅。
## 使用
1. 编辑 [`feeds.yml`](feeds.yml),替换示例订阅源并按需增加分组。
2. 将仓库推送到 Gitea。
3. 在仓库设置中启用 Actions,并确保实例上已有可用的 `act_runner`。
4. 在 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`:可为分组指定仓库内的相对输出路径。
同一个 URL 被多个分组引用时只会请求一次。输出按发布时间倒序排列并截取 `max_items` 条,不进行过滤或去重。内容不变时不会重写文件,也就不会制造空提交。
## 本地运行
```bash
python -m venv .venv
python -m pip install -r requirements.txt
python merge.py
python -m unittest discover -s tests -v
```
首次成功运行后会创建 `public/` 目录。请将生成的 XML 一并提交,后续源临时不可用时阅读器仍可访问最近一次结果。