Skip to content

Commit

Permalink
Improved id handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
SlyMarbo committed Aug 7, 2013
1 parent aeedb73 commit e0fdf32
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rss 2.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ func parseRSS2(data []byte, read *db) (*Feed, error) {
// Process items.
for _, item := range channel.Items {

if item.ID == "" {
if item.Link == "" {
fmt.Printf("Warning: Item %q has no ID or link and will be ignored.\n", item.Title)
continue
}
item.ID = item.Link
}

// Skip items already known.
if read.req <- item.ID; <-read.res {
continue
Expand All @@ -83,14 +91,6 @@ func parseRSS2(data []byte, read *db) (*Feed, error) {
next.ID = item.ID
next.Read = false

if next.ID == "" {
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 {
fmt.Printf("Warning: Item %q has duplicate ID.\n", next.Title)
continue
Expand Down

0 comments on commit e0fdf32

Please sign in to comment.