From ed75d06bce3e18c390e8996f9cb3e4ac3e3fab9e Mon Sep 17 00:00:00 2001 From: Hiroyuki Shigeta Date: Mon, 5 May 2014 16:15:17 +0900 Subject: [PATCH] add `dc:date` item support --- rss 1.0.go | 8 +++++++- rss 2.0.go | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rss 1.0.go b/rss 1.0.go index 33177f3..bdc9669 100644 --- a/rss 1.0.go +++ b/rss 1.0.go @@ -87,6 +87,11 @@ func parseRSS1(data []byte, read *db) (*Feed, error) { if err != nil { return nil, err } + } else if item.PubDate != "" { + next.Date, err = parseTime(item.PubDate) + if err != nil { + return nil, err + } } next.ID = item.ID next.Read = false @@ -126,7 +131,8 @@ type rss1_0Item struct { Title string `xml:"title"` Content string `xml:"description"` Link string `xml:"link"` - Date string `xml:"pubDate"` + PubDate string `xml:"pubDate"` + Date string `xml:"date"` ID string `xml:"guid"` } diff --git a/rss 2.0.go b/rss 2.0.go index a62442e..b499480 100644 --- a/rss 2.0.go +++ b/rss 2.0.go @@ -87,6 +87,11 @@ func parseRSS2(data []byte, read *db) (*Feed, error) { if err != nil { return nil, err } + } else if item.PubDate != "" { + next.Date, err = parseTime(item.PubDate) + if err != nil { + return nil, err + } } next.ID = item.ID next.Read = false @@ -126,7 +131,8 @@ type rss2_0Item struct { Title string `xml:"title"` Content string `xml:"description"` Link string `xml:"link"` - Date string `xml:"pubDate"` + PubDate string `xml:"pubDate"` + Date string `xml:"date"` ID string `xml:"guid"` }