add podcast support
This commit is contained in:
25
rss/item.go
25
rss/item.go
@@ -16,17 +16,19 @@ import (
|
||||
)
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
Link string
|
||||
Content string
|
||||
TS time.Time
|
||||
Name string
|
||||
Link string
|
||||
Content string
|
||||
Enclosures []string
|
||||
TS time.Time
|
||||
}
|
||||
|
||||
func (item *Item) String() string {
|
||||
return fmt.Sprintf("Name %v, Link %v, Content %v, TS %v",
|
||||
return fmt.Sprintf("Name %v, Link %v, Content %v, Enclosures %v, TS %v",
|
||||
item.Name,
|
||||
item.Link,
|
||||
len(item.Content),
|
||||
item.Enclosures,
|
||||
item.TS.Local(),
|
||||
)
|
||||
}
|
||||
@@ -51,11 +53,16 @@ func (item *Item) Serialize() ([]byte, error) {
|
||||
}
|
||||
|
||||
func FromGofeedItem(gfitem *gofeed.Item, filter string) *Item {
|
||||
enclosures := []string{}
|
||||
for i := range gfitem.Enclosures {
|
||||
enclosures = append(enclosures, gfitem.Enclosures[i].URL)
|
||||
}
|
||||
item := &Item{
|
||||
Name: gfitem.Title,
|
||||
Link: gfitem.Link,
|
||||
Content: "",
|
||||
TS: *gofeedItemTS(gfitem),
|
||||
Name: gfitem.Title,
|
||||
Link: gfitem.Link,
|
||||
Content: "",
|
||||
Enclosures: enclosures,
|
||||
TS: *gofeedItemTS(gfitem),
|
||||
}
|
||||
content := gfitem.Content
|
||||
if content == "" {
|
||||
|
||||
Reference in New Issue
Block a user