From fc102d94457cc280ebb39402dae9512590e92839 Mon Sep 17 00:00:00 2001 From: Abel Luck Date: Sun, 29 Mar 2026 14:10:20 +0200 Subject: [PATCH 1/2] Add file URL RSS feed coverage --- demo/README.md | 17 +++++++++++++++++ demo/fixtures/local-feed.rss | 16 ++++++++++++++++ tests/test_file_feeds.py | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 demo/fixtures/local-feed.rss create mode 100644 tests/test_file_feeds.py diff --git a/demo/README.md b/demo/README.md index 0daa7bc..7a2d23d 100644 --- a/demo/README.md +++ b/demo/README.md @@ -15,3 +15,20 @@ Because `out_dir` in [`demo/repub.toml`](/home/abel/src/guardianproject/anynews/ ## Files - `repub.toml`: example runtime config with feed definitions and Scrapy overrides +- `fixtures/local-feed.rss`: simple local RSS fixture for `file://` feed testing + +## Local File Feed + +`repub` already accepts absolute `file://` feed URIs. To point it at the demo fixture, generate an absolute URI like this from the repo root: + +```shell +python3 -c 'from pathlib import Path; print(Path("demo/fixtures/local-feed.rss").resolve().as_uri())' +``` + +Then use that value in a config entry: + +```toml +[[feeds]] +name = "local-demo" +url = "file:///absolute/path/to/demo/fixtures/local-feed.rss" +``` diff --git a/demo/fixtures/local-feed.rss b/demo/fixtures/local-feed.rss new file mode 100644 index 0000000..993e1c4 --- /dev/null +++ b/demo/fixtures/local-feed.rss @@ -0,0 +1,16 @@ + + + + Local Demo Feed + https://example.com/ + Simple local RSS fixture for file:// testing + en + + Local Demo Entry + https://example.com/local-demo-entry + Hello from a local file feed. + https://example.com/local-demo-entry + Sat, 29 Mar 2026 12:00:00 GMT + + + diff --git a/tests/test_file_feeds.py b/tests/test_file_feeds.py new file mode 100644 index 0000000..584562a --- /dev/null +++ b/tests/test_file_feeds.py @@ -0,0 +1,36 @@ +from pathlib import Path + +from repub import entrypoint as entrypoint_module + + +def test_entrypoint_supports_file_feed_urls(tmp_path: Path, monkeypatch) -> None: + fixture_path = ( + Path(__file__).resolve().parents[1] / "demo" / "fixtures" / "local-feed.rss" + ).resolve() + config_path = tmp_path / "repub.toml" + config_path.write_text( + f""" +out_dir = "out" + +[[feeds]] +name = "local-file" +url = "{fixture_path.as_uri()}" + +[scrapy.settings] +LOG_LEVEL = "ERROR" +DOWNLOAD_TIMEOUT = 5 +""".strip() + + "\n", + encoding="utf-8", + ) + + monkeypatch.setattr(entrypoint_module, "check_runtime", lambda *_: True) + + exit_code = entrypoint_module.entrypoint(["--config", str(config_path)]) + + output_path = tmp_path / "out" / "local-file.rss" + assert exit_code == 0 + assert output_path.exists() + output = output_path.read_text(encoding="utf-8") + assert "Local Demo Feed" in output + assert "Local Demo Entry" in output From 30b81934a82eb499fc30c017c99c67ebc422ddf6 Mon Sep 17 00:00:00 2001 From: Abel Luck Date: Sun, 29 Mar 2026 14:10:52 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d969ccb..31584d0 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ See [`demo/README.md`](/home/abel/src/guardianproject/anynews/republisher-redux/ - [x] Video transcoding - [ ] Image compression - Do we want this? - [x] Download and rewrite media embedded in content/CDATA fields -- [ ] Config file to drive the program +- [x] Config file to drive the program - [ ] Daemonize the program - [ ] Operationalize with metrics and error reporting @@ -47,7 +47,7 @@ See [`demo/README.md`](/home/abel/src/guardianproject/anynews/republisher-redux/ republisher-redux, a tool to mirror RSS/ATOM feeds completely offline -Copyright (C) 2024 Abel Luck +Copyright (C) 2024-2026 Abel Luck This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as