Back to previous API.
(IE, the previous breaking changes are unbroken.)
This commit is contained in:
parent
2c67b94a04
commit
c6a7816435
2
atom.go
2
atom.go
|
@ -56,7 +56,7 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
|
||||||
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")
|
||||||
i.PubDate, _ = parseTime(item.S(ns, "updated"))
|
i.PubDate = item.S(ns, "updated")
|
||||||
i.Description = item.S(ns, "summary")
|
i.Description = item.S(ns, "summary")
|
||||||
|
|
||||||
links := item.SelectNodes(ns, "link")
|
links := item.SelectNodes(ns, "link")
|
||||||
|
|
10
item.go
10
item.go
|
@ -16,7 +16,7 @@ type Item struct {
|
||||||
Comments string
|
Comments string
|
||||||
Enclosures []*Enclosure
|
Enclosures []*Enclosure
|
||||||
Guid *string
|
Guid *string
|
||||||
PubDate time.Time
|
PubDate string
|
||||||
Source *Source
|
Source *Source
|
||||||
|
|
||||||
// Atom specific fields
|
// Atom specific fields
|
||||||
|
@ -28,14 +28,18 @@ type Item struct {
|
||||||
Extensions map[string]map[string][]Extension
|
Extensions map[string]map[string][]Extension
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Item) ParsedPubDate() (time.Time, error) {
|
||||||
|
return parseTime(i.PubDate)
|
||||||
|
}
|
||||||
|
|
||||||
func (i *Item) Key() string {
|
func (i *Item) Key() string {
|
||||||
switch {
|
switch {
|
||||||
case i.Guid != nil && len(*i.Guid) != 0:
|
case i.Guid != nil && len(*i.Guid) != 0:
|
||||||
return *i.Guid
|
return *i.Guid
|
||||||
case len(i.Id) != 0:
|
case len(i.Id) != 0:
|
||||||
return i.Id
|
return i.Id
|
||||||
case len(i.Title) > 0 && !i.PubDate.IsZero():
|
case len(i.Title) > 0 && len(i.PubDate) > 0:
|
||||||
return i.Title + i.PubDate.String()
|
return i.Title + i.PubDate
|
||||||
default:
|
default:
|
||||||
h := md5.New()
|
h := md5.New()
|
||||||
io.WriteString(h, i.Description)
|
io.WriteString(h, i.Description)
|
||||||
|
|
2
rss.go
2
rss.go
|
@ -162,7 +162,7 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
|
||||||
i.Guid = &guid
|
i.Guid = &guid
|
||||||
}
|
}
|
||||||
|
|
||||||
i.PubDate, _ = parseTime(item.S(ns, "pubDate"))
|
i.PubDate = item.S(ns, "pubDate")
|
||||||
|
|
||||||
tl = item.SelectNodes(ns, "category")
|
tl = item.SelectNodes(ns, "category")
|
||||||
for _, lv := range tl {
|
for _, lv := range tl {
|
||||||
|
|
Loading…
Reference in New Issue