- commit
- d998998b9b25a30126dfca9297ada4a2ecba5b34
- parent
- f0a2e663e09caf99fcfaa6f795690dd3fd850a49
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-08-11 20:39
support URNs instead of numeric IDs
Diffstat
| M | audiothek.go | 7 | +++---- |
| M | index.html | 4 | ++-- |
2 files changed, 5 insertions, 6 deletions
diff --git a/audiothek.go b/audiothek.go
@@ -21,7 +21,7 @@ import ( 21 21 22 22 const COUNT = 20 23 2324 -1 var urlPattern = regexp.MustCompile(`^/([0-9]+)\.(rss|m3u)$`)-1 24 var urlPattern = regexp.MustCompile(`^/([0-9]+|urn:ard:show:[a-z0-9]+)\.(rss|m3u)$`) 25 25 var origin = "" 26 26 27 27 const QUERY = ` @@ -119,7 +119,7 @@ func escape(s string) string { 119 119 return template.HTMLEscapeString(s) 120 120 } 121 121122 -1 func fetchShow(id int, offset int) (Show, error) {-1 122 func fetchShow(id string, offset int) (Show, error) { 123 123 url := "https://api.ardaudiothek.de/graphql" 124 124 jsonValue, _ := json.Marshal(map[string]interface{}{ 125 125 "query": QUERY, @@ -230,14 +230,13 @@ func handle(w http.ResponseWriter, r *http.Request) { 230 230 return 231 231 } 232 232233 -1 id, _ := strconv.Atoi(matches[1])234 233 offsetStr := r.URL.Query().Get("offset") 235 234 offset, err := strconv.Atoi(offsetStr) 236 235 if err != nil { 237 236 offset = 0 238 237 } 239 238240 -1 show, err := fetchShow(id, offset)-1 239 show, err := fetchShow(matches[1], offset) 241 240 if err != nil { 242 241 http.Error(w, err.Error(), http.StatusNotFound) 243 242 return
diff --git a/index.html b/index.html
@@ -8,8 +8,8 @@ 8 8 </head> 9 9 <body> 10 10 <h1>RSS Feeds for ARD Audiothek</h1>11 -1 <pre><code>https://audiothek.ce9e.org/{id}.rss</code></pre>12 -1 <p>You can find the numeric ID in the URL in the <a href="https://www.ardaudiothek.de/">ARD Audiothek</a>.</p>-1 11 <pre><code>https://audiothek.ce9e.org/urn:ard:show:{id}.rss</code></pre> -1 12 <p>You can find the ID in the URL in the <a href="https://www.ardaudiothek.de/">ARD Audiothek</a>.</p> 13 13 <h2>Background</h2> 14 14 <p>Germany’s public broadcasting is publicly funded and therefore publishes much of its programming publicly. In the past, this was mostly done by offering podcasts. However, recently, most of these podcasts have been scrapped in favor of the central platform “ARD Audiothek”.</p> <p>In theory, the central platform could offer the content as RSS feeds. However, that is not currently supported. On request they explained:</p> 15 15 <blockquote lang="de">