Also parse text/xml

This commit is contained in:
Peter Stuifzand 2018-04-07 21:21:21 +02:00
parent b8034af2aa
commit a99048c9ab
2 changed files with 7 additions and 6 deletions

View File

@ -145,7 +145,7 @@ func (b *memoryBackend) Fetch3(channel, fetchURL string) error {
item.Published = feedItem.DatePublished
b.channelAddItem(channel, item)
}
} else if strings.HasPrefix(contentType, "application/rss+xml") || strings.HasPrefix(contentType, "application/atom+xml") {
} else if strings.HasPrefix(contentType, "text/xml") || strings.HasPrefix(contentType, "application/rss+xml") || strings.HasPrefix(contentType, "application/atom+xml") {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Printf("Error while parsing rss/atom feed: %s\n", err)
@ -161,6 +161,7 @@ func (b *memoryBackend) Fetch3(channel, fetchURL string) error {
var item microsub.Item
item.Name = feedItem.Title
item.Content.HTML = feedItem.Content
item.Content.Text = feedItem.Content
item.URL = feedItem.Link
item.Summary = []string{feedItem.Summary}
item.Id = feedItem.ID

View File

@ -39,14 +39,14 @@ type Channel struct {
type Author struct {
Filled bool `json:"-"`
Type string `json:"type"`
Name string `json:"name"`
URL string `json:"url"`
Photo string `json:"photo"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Photo string `json:"photo,omitempty"`
}
type Content struct {
Text string `json:"text"`
HTML string `json:"html"`
Text string `json:"text,omitempty"`
HTML string `json:"html,omitempty"`
}
// Item is a post object