├── Dockerfile ├── README.md ├── ardaudiothek-rss.php ├── docker-compose.yml └── index.html /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-apache 2 | COPY ./ardaudiothek-rss.php /var/www/html/index.php 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARD Audiothek rss feed generator 2 | 3 | ## Dependencies 4 | - php-curl 5 | 6 | ## Usage 7 | 8 | Simply pass the id of the show with the show parameter 9 | 10 | Show url: https://www.ardaudiothek.de/sendung/kalk-und-welk/10777871/ 11 | 12 | Id: 10777871 13 | 14 | Feed url: https://example.com/ardaudiothek-rss.php?show=10777871 15 | 16 | If you only want to receive the n newest episodes, pass the latest parameter too: 17 | 18 | Feed url with 10 newest episodes: https://example.com/ardaudiothek-rss.php?show=10777871&latest=10 19 | -------------------------------------------------------------------------------- /ardaudiothek-rss.php: -------------------------------------------------------------------------------- 1 | Invalid "show" parameter'); 27 | } 28 | $show = getShowJsonGraphql($showId, $latest); 29 | 30 | 31 | print(''); 32 | print(''); 33 | 34 | printf('%s', escapeString($show->title)); 35 | printf('%s', $show->sharingUrl); 36 | 37 | 38 | print(''); 39 | printf('%s', escapeString(str_replace("{width}", "448", $show->image->url1X1))); 40 | printf('%s', escapeString($show->title)); 41 | printf('https://www.ardaudiothek.de%s', $show->path); 42 | print(''); 43 | 44 | printf('%s', escapeString($show->synopsis)); 45 | printf('', "//{$_SERVER['HTTP_HOST']}".escapeString($_SERVER['REQUEST_URI'])); 46 | 47 | 48 | foreach ($show->items->nodes as $item) { 49 | $length = getFileLength($item->audios[0]->url); 50 | 51 | print(''); 52 | printf('%s', escapeString($item->title)); 53 | printf('%s', escapeString($item->synopsis)); 54 | printf('%s', escapeString($item->sharingUrl)); 55 | printf('%s', escapeString($item->sharingUrl)); 56 | printf('', escapeString($item->audios[0]->url), $length); 57 | printf('', escapeString($item->audios[0]->downloadUrl), $item->duration); 58 | printf('%s', (new DateTime($item->publicationStartDateAndTime))->format(DATE_RSS)); 59 | printf('%d', $item->duration); 60 | 61 | print(''); 62 | printf('%s', escapeString(str_replace("{width}", "448", $item->image->url1X1))); 63 | printf('%s', escapeString($show->title)); 64 | print(''); 65 | printf('', escapeString(str_replace("{width}", "448", $item->image->url1X1))); 66 | 67 | print(''); 68 | } 69 | 70 | 71 | print(''); 72 | print(''); 73 | 74 | 75 | function getShowJson($showId) { 76 | $url_unvalidate = sprintf('https://api.ardaudiothek.de/programsets/%d', $showId); 77 | $url = filter_var($url_unvalidate, FILTER_VALIDATE_URL); 78 | if ($url) { 79 | $filesize = getFileLength($url); 80 | } else { 81 | exit ; 82 | } 83 | 84 | $ch = curl_init(); 85 | 86 | curl_setopt($ch, CURLOPT_URL, $url); 87 | curl_setopt($ch, CURLOPT_HEADER, 0); 88 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 89 | 90 | 91 | $output = curl_exec($ch); 92 | 93 | $obj = json_decode($output); 94 | 95 | return $obj->data->programSet; 96 | } 97 | 98 | function getShowJsonGraphql($showId, $latest){ 99 | $url = 'https://api.ardaudiothek.de/graphql'; 100 | 101 | $query='{"query":"{programSet(id:%d){title,path,synopsis,sharingUrl,image{url,url1X1,},items(orderBy:PUBLISH_DATE_DESC,filter:{isPublished:{equalTo:true}}first:%d){nodes{title,summary,synopsis,sharingUrl,publicationStartDateAndTime:publishDate,url,episodeNumber,duration,image{url,url1X1,},isPublished,audios{url,downloadUrl,size,mimeType,}}}}}"}'; 102 | 103 | $query = sprintf($query, $showId, $latest); 104 | 105 | $headers = array(); 106 | $headers[] = 'Content-Type: application/json'; 107 | 108 | $ch = curl_init(); 109 | 110 | curl_setopt($ch, CURLOPT_URL, $url); 111 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 112 | curl_setopt($ch, CURLOPT_POSTFIELDS, $query); 113 | curl_setopt($ch, CURLOPT_POST, 1); 114 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 115 | 116 | $output = curl_exec($ch); 117 | 118 | $obj = json_decode($output); 119 | 120 | return $obj->data->programSet; 121 | } 122 | 123 | 124 | function escapeString($string) { 125 | return htmlspecialchars($string, ENT_QUOTES, 'UTF-8'); 126 | } 127 | 128 | function getFileLength($url) { 129 | $headers = get_headers($url, 1); 130 | if (isset($headers['Content-Length'])) { 131 | $filesize = $headers['Content-Length']; 132 | } else { 133 | $filesize = -1; 134 | } 135 | return $filesize; 136 | } 137 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.3' 2 | 3 | services: 4 | application: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile 8 | ports: 9 | - 8080:80 10 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 39 | Nutzung des Audiothek-RSS-Feed Generators 40 | 41 | 42 | 43 | 44 | 45 |

Instruktionen

46 |

Diese Seite kann einen RSS-Feed aus den Daten der ARD-Audiothek erzeugen. Dazu sind folgende Schritte nötig:

47 | 52 |

Sollte man nur einen Feed mit den letzten X Folgen abonnieren wollen, kann man auch ein "&latest=X" anhängen: Beispiel Wild Wild Web, letzte 10 Folgen. 53 |

54 | 61 | 62 |

Feed Öffnen

63 |

Im folgenden Feld die gewünschte Feed-ID eingeben, dann auf "Feed-Öffnen" klicken.

64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | --------------------------------------------------------------------------------