Remove the haveItem check for RSS and Atom

The haveItem check for RSS and Atom causes the feeds to act unexpectedly.
For RSS, the checked tags don't necessarily have to be unique.  For atom,
it is allowed to have duplicate items (including duplicated ids) in one feed,
so this shouldn't be stopped either.
This commit is contained in:
Matthew Dawson 2013-07-07 11:55:10 -04:00
parent 92961717d5
commit 9123b6bc67
2 changed files with 0 additions and 49 deletions

24
atom.go
View File

@ -22,26 +22,6 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
return nil return nil
} }
haveItem := func(ch *Channel, id, title, desc string) bool {
for _, item := range ch.Items {
switch {
case len(id) > 0:
if item.Id == id {
return true
}
case len(title) > 0:
if item.Title == title {
return true
}
case len(desc) > 0:
if item.Description == desc {
return true
}
}
}
return false
}
var ch *Channel var ch *Channel
var i *Item var i *Item
var tn *xmlx.Node var tn *xmlx.Node
@ -91,10 +71,6 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
list = node.SelectNodes(ns, "entry") list = node.SelectNodes(ns, "entry")
for _, item := range list { for _, item := range list {
if haveItem(ch, item.S(ns, "id"), item.S(ns, "title"), item.S(ns, "summary")) {
continue
}
i = new(Item) i = new(Item)
i.Title = item.S(ns, "title") i.Title = item.S(ns, "title")
i.Id = item.S(ns, "id") i.Id = item.S(ns, "id")

25
rss.go
View File

@ -28,26 +28,6 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
return nil return nil
} }
haveItem := func(ch *Channel, pubdate, title, desc string) bool {
for _, item := range ch.Items {
switch {
case len(pubdate) > 0:
if item.PubDate == pubdate {
return true
}
case len(title) > 0:
if item.Title == title {
return true
}
case len(desc) > 0:
if item.Description == desc {
return true
}
}
}
return false
}
var ch *Channel var ch *Channel
var i *Item var i *Item
var n *xmlx.Node var n *xmlx.Node
@ -139,11 +119,6 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
} }
for _, item := range list { for _, item := range list {
if haveItem(ch, item.S(ns, "pubDate"),
item.S(ns, "title"), item.S(ns, "description")) {
continue
}
i = new(Item) i = new(Item)
i.Title = item.S(ns, "title") i.Title = item.S(ns, "title")
i.Description = item.S(ns, "description") i.Description = item.S(ns, "description")