Skip to content

Commit

Permalink
Attempt to use link if no ID found, to help resolve missing IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyMarbo committed Apr 23, 2013
1 parent 0099aa7 commit a0bf84d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions rss 1.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions rss 2.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a0bf84d

Please sign in to comment.