Use preferably the published date for Atom feeds
YouTube feeds use the published date for the original creation date.
This commit is contained in:
parent
c71681b197
commit
ed6ae7e0d2
2 changed files with 7 additions and 3 deletions
|
@ -130,9 +130,13 @@ func getRelationURL(links []atomLink, relation string) string {
|
|||
}
|
||||
|
||||
func getDate(a *atomEntry) time.Time {
|
||||
dateText := a.Updated
|
||||
// Note: The published date represents the original creation date for YouTube feeds.
|
||||
// Example:
|
||||
// <published>2019-01-26T08:02:28+00:00</published>
|
||||
// <updated>2019-01-29T07:27:27+00:00</updated>
|
||||
dateText := a.Published
|
||||
if dateText == "" {
|
||||
dateText = a.Published
|
||||
dateText = a.Updated
|
||||
}
|
||||
|
||||
if dateText != "" {
|
||||
|
|
|
@ -546,7 +546,7 @@ func TestParseEntryWithPublishedAndUpdated(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
if !feed.Entries[0].Date.Equal(time.Date(2003, time.December, 13, 18, 30, 2, 0, time.UTC)) {
|
||||
if !feed.Entries[0].Date.Equal(time.Date(2002, time.November, 12, 18, 30, 2, 0, time.UTC)) {
|
||||
t.Errorf("Incorrect entry date, got: %v", feed.Entries[0].Date)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue