- commit
- e6470c2564f534f03c7ad365f4880c90aa07ecd6
- parent
- 478caae9878934c9e7bece08dbfce4bb2f85515d
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-12-05 11:23
fix pubDate format see https://www.rssboard.org/rss-specification
Diffstat
| M | audiothek.go | 14 | +++++++++++++- |
1 files changed, 13 insertions, 1 deletions
diff --git a/audiothek.go b/audiothek.go
@@ -17,6 +17,7 @@ import ( 17 17 "strings" 18 18 "syscall" 19 19 "text/template" -1 20 "time" 20 21 ) 21 22 22 23 const COUNT = 20 @@ -119,6 +120,14 @@ func escape(s string) string { 119 120 return template.HTMLEscapeString(s) 120 121 } 121 122 -1 123 func convertDate(s string) (string, error) { -1 124 t, err := time.Parse(time.RFC3339, s) -1 125 if err != nil { -1 126 return "", err -1 127 } -1 128 return t.Format(time.RFC822), nil -1 129 } -1 130 122 131 func fetchShow(id string, offset int) (Show, error) { 123 132 url := "https://api.ardaudiothek.de/graphql" 124 133 jsonValue, _ := json.Marshal(map[string]interface{}{ @@ -159,7 +168,10 @@ func renderItem(w http.ResponseWriter, item Item) { 159 168 fmt.Fprintf(w, "\t\t\t<title>%s</title>\n", escape(item.Title)) 160 169 fmt.Fprintf(w, "\t\t\t<link>%s</link>\n", escape(item.SharingUrl)) 161 170 fmt.Fprintf(w, "\t\t\t<guid>%s</guid>\n", escape(item.SharingUrl))162 -1 fmt.Fprintf(w, "\t\t\t<pubDate>%s</pubDate>\n", escape(item.PublishDate))-1 171 publishDate, err := convertDate(item.PublishDate) -1 172 if err == nil { -1 173 fmt.Fprintf(w, "\t\t\t<pubDate>%s</pubDate>\n", escape(publishDate)) -1 174 } 163 175 fmt.Fprintf(w, "\t\t\t<description>%s</description>\n", escape(item.Summary)) 164 176 fmt.Fprintf(w, "\t\t\t<itunes:duration>%d</itunes:duration>\n", item.Duration) 165 177 fmt.Fprintf(w, "\t\t\t<itunes:image href=\"%s\" />\n", escape(