From a0bf84d18a70f70144796e840735926261f73398 Mon Sep 17 00:00:00 2001 From: Jamie Hall Date: Tue, 23 Apr 2013 15:26:06 +0100 Subject: [PATCH] Attempt to use link if no ID found, to help resolve missing IDs --- rss 1.0.go | 7 +++++-- rss 2.0.go | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rss 1.0.go b/rss 1.0.go index 19d43de..75e324e 100644 --- a/rss 1.0.go +++ b/rss 1.0.go @@ -83,8 +83,11 @@ func parseRSS1(data []byte, read *db) (*Feed, error) { next.Read = false if next.ID == "" { - fmt.Printf("Warning: Item %q has no ID and will be ignored.\n", next.Title) - continue + if next.Link == "" { + fmt.Printf("Warning: Item %q has no ID or link and will be ignored.\n", next.Title) + continue + } + next.ID = next.Link } if _, ok := out.ItemMap[next.ID]; ok { diff --git a/rss 2.0.go b/rss 2.0.go index a5f377a..c53d8de 100644 --- a/rss 2.0.go +++ b/rss 2.0.go @@ -84,8 +84,11 @@ func parseRSS2(data []byte, read *db) (*Feed, error) { next.Read = false if next.ID == "" { - fmt.Printf("Warning: Item %q has no ID and will be ignored.\n", next.Title) - continue + if next.Link == "" { + fmt.Printf("Warning: Item %q has no ID or link and will be ignored.\n", next.Title) + continue + } + next.ID = next.Link } if _, ok := out.ItemMap[next.ID]; ok {