commit - 722a6f393041fe09c87f797a39d8ff00d157fe3d
commit + 38dff9091688843ea4d52933f27306435c054355
blob - cf10553fa10c96c2b5bc36e6d3ea9193cbb8e4d0
blob + da992a297e97bd57d0db1dac3d28069d234372b2
--- rss/rss.go
+++ rss/rss.go
"time"
)
-type RFC822Time struct {
+type RFC1123Time struct {
time.Time
}
-const rfc822Layout = "Mon, 2 Jan 2006 15:04:05 -0700"
-
-func (ct *RFC822Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
+func (ct *RFC1123Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var content string
if err := d.DecodeElement(&content, &start); err != nil {
return err
}
- t, err := time.Parse(rfc822Layout, content)
+ t, err := time.Parse(time.RFC1123Z, content)
if err != nil {
return err
}
}
type Channel struct {
- Title string `xml:"title"`
- Description string `xml:"description"`
- Link []string `xml:"link"`
- Copyright string `xml:"copyright"`
- LastBuildDate RFC822Time `xml:"lastBuildDate"`
- PubDate RFC822Time `xml:"pubDate"`
- TTL int `xml:"ttl"`
- Items []Item `xml:"item"`
+ Title string `xml:"title"`
+ Description string `xml:"description"`
+ Link []string `xml:"link"`
+ Copyright string `xml:"copyright"`
+ LastBuildDate RFC1123Time `xml:"lastBuildDate"`
+ PubDate RFC1123Time `xml:"pubDate"`
+ TTL int `xml:"ttl"`
+ Items []Item `xml:"item"`
ITunesImage string `xml:"itunes:image"`
ITunesAuthor string `xml:"itunes:author"`
}
type Item struct {
- Title string `xml:"title"`
- Description string `xml:"description"`
- Link string `xml:"link"`
- GUUID string `xml:"guid"`
- PubDate RFC822Time `xml:"pubDate"`
+ Title string `xml:"title"`
+ Description string `xml:"description"`
+ Link string `xml:"link"`
+ GUUID string `xml:"guid"`
+ PubDate RFC1123Time `xml:"pubDate"`
}
func Marshal(rss *RSS) ([]byte, error) {