Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit 9944636

Browse files
committed
Expanded RSS 2 field support
1 parent cb5d9e2 commit 9944636

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

rss2.go

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,48 @@ import (
2929
type RSS2 struct {
3030
XMLName xml.Name `xml:"rss" json:"-"`
3131
Version string `xml:"version,attr" json:"version"`
32+
3233
// Required
3334
Title string `xml:"channel>title" json:"title"`
3435
Link string `xml:"channel>link" json:"link"`
3536
Description string `xml:"channel>description" json:"description"`
37+
3638
// Optional
37-
PubDate string `xml:"channel>pubDate" json:"pubDate,omitempty"`
38-
ItemList []Item `xml:"channel>item" json:"item,omitempty"`
39+
Language string `xml:"channel>language,omitempty" json:"language,omitempty"`
40+
Copyright string `xml:"channel>copyright,omitempty" json:"copyright,omitempty"`
41+
ManagingEditor string `xml:"channel>managingEditor,omitempty" json:"managingEditor,omitempty"`
42+
WebMaster string `xml:"channel>webMaster,omitempty" json:"webMaster,omitempty"`
43+
PubDate string `xml:"channel>pubDate,omitempty" json:"pubDate,omitempty"`
44+
LastBuildDate string `xml:"channel>lastBuildDate,omitempty" json:"lastBuildDate,omitempty"`
45+
Category string `xml:"channel>category,omitempty" json:"category,omitempty"`
46+
Generator string `xml:"channel>generator,omitempty" json:"generator,omitempty"`
47+
Docs string `xml:"channel>docs,omitempty" json:"docs,omitempty"`
48+
Cloud string `xml:"channel>cloud,omitempty" json:"cloud,omitempty"`
49+
TTL string `xml:"channel>ttl,omitempty" json:"ttl,omitempty"`
50+
Image string `xml:"channel>image,omitempty" json:"image,omitempty"`
51+
Rating string `xml:"channel>rating,omitempty" json:"rating,omitempty"`
52+
SkipHours string `xml:"channel>skipHours,omitempty" json:"skipHours,omitempty"`
53+
SkipDays string `xml:"channel>skipDays,omitempty" json:"skipDays,omitempty"`
54+
ItemList []Item `xml:"channel>item,omitempty" json:"item,omitempty"`
3955
}
4056

4157
type Item struct {
4258
// Optional according to Dave Winer
4359
Title string `xml:"title" json:"title,omitempty"`
60+
4461
// Required
4562
Link string `xml:"link" json:"link"`
63+
4664
// Optional
47-
Description template.HTML `xml:"description" json:"description,omitempty"`
48-
Content template.HTML `xml:"encoded" json:"encoded,omitempty"`
49-
PubDate string `xml:"pubDate" json:"pubDate,omitempty"`
50-
Comments string `xml:"comments" json:"comments,omitempty"`
65+
Description template.HTML `xml:"description,omitempty" json:"description,omitempty"`
66+
Author string `xml:"author,omitempty" json:"omitempty"`
67+
Category string `xml:"category,omitempty" json:"category,omitempty"`
68+
Content template.HTML `xml:"encoded,omitempty" json:"encoded,omitempty"`
69+
PubDate string `xml:"pubDate,omitempty" json:"pubDate,omitempty"`
70+
Comments string `xml:"comments,omitempty" json:"comments,omitempty"`
71+
Enclosure string `xml:"enclosure,omitempty" json:"enclosure,omitempty"`
72+
GUID string `xml:"guid,omitempty" json:"guid,omitempty"`
73+
Source string `xml:"source,omitempty" json:"source,omitempty"`
5174
}
5275

5376
// Parse return an RSS2 document as a RSS2 structure.

0 commit comments

Comments
 (0)