diff --git a/item.go b/item.go index acfeb34..c5e65fb 100644 --- a/item.go +++ b/item.go @@ -9,7 +9,7 @@ type Item struct { Categories []*Category Comments string Enclosures []*Enclosure - Guid string + Guid *string PubDate string Source *Source diff --git a/rss.go b/rss.go index 763593e..29f2932 100644 --- a/rss.go +++ b/rss.go @@ -144,15 +144,19 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) { } if n = item.SelectNode(ns, "author"); n != nil { - i.Author = Author{} i.Author.Name = n.GetValue() - } - if n = item.SelectNode(ns, "creator"); n != nil { - i.Author = Author{ Name: n.GetValue() } + + } else if n = item.SelectNode(ns, "creator"); n != nil { + i.Author.Name = n.GetValue() } i.Comments = item.S(ns, "comments") - i.Guid = item.S(ns, "guid") + + guid := item.S(ns, "guid") + if len(guid) > 0 { + i.Guid = &guid + } + i.PubDate = item.S(ns, "pubDate") tl = item.SelectNodes(ns, "category")