1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Add support for published tag in Atom feeds

This commit is contained in:
neepl 2018-07-18 07:52:05 +03:00 committed by Frédéric Guillot
parent 73a6e617bb
commit 5365f31e90
2 changed files with 59 additions and 2 deletions

View file

@ -30,6 +30,7 @@ type atomFeed struct {
type atomEntry struct {
ID string `xml:"id"`
Title atomContent `xml:"title"`
Published string `xml:"published"`
Updated string `xml:"updated"`
Links []atomLink `xml:"link"`
Summary string `xml:"summary"`
@ -128,8 +129,13 @@ func getRelationURL(links []atomLink, relation string) string {
}
func getDate(a *atomEntry) time.Time {
if a.Updated != "" {
result, err := date.Parse(a.Updated)
dateText := a.Updated
if dateText == "" {
dateText = a.Published
}
if dateText != "" {
result, err := date.Parse(dateText)
if err != nil {
logger.Error("atom: %v", err)
return time.Now()