1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-09-12 16:45:08 +00:00

Fix RSS feed parsing by reading from local artifacts

- Change fetch_feed to read from local file instead of HTTP request
- Update feed path to use ../public/index.xml from GitLab CI artifacts
- Add better error messages for file reading and parsing failures
- Resolves ParseError(NoFeedRoot) by avoiding 404 from live website
This commit is contained in:
2025-08-22 23:34:32 -06:00
parent a6dd33ce5f
commit 54f2a1bc53

View File

@@ -227,10 +227,11 @@ async fn get_existing_post_id(slug: &str, token: &str) -> Option<String> {
} }
} }
async fn fetch_feed(url: &str) -> Vec<Entry> { async fn fetch_feed(path: &str) -> Vec<Entry> {
let content = reqwest::get(url).await.unwrap().text().await.unwrap(); // Read from local file instead of HTTP request
let content = std::fs::read_to_string(path).expect("Failed to read RSS feed file");
let feed = parser::parse(content.as_bytes()).unwrap(); let feed = parser::parse(content.as_bytes()).expect("Failed to parse RSS feed");
feed.entries feed.entries
} }
@@ -296,7 +297,7 @@ async fn main() {
let feed = "https://projects.ansonbiggs.com/index.xml"; let feed = "../public/index.xml";
// Split the key into ID and SECRET // Split the key into ID and SECRET
let (id, secret) = ghost_admin_api_key let (id, secret) = ghost_admin_api_key