Merge pull request #20 from MJDSys/RemoveHaveItem

Remove the haveItem check for RSS and Atom
This commit is contained in:
jimt 2013-07-07 15:09:38 -07:00
commit c173d50291
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")