pub / yt2rss

Transforms a youtube channel into a podcast RSS feed to insert into a podcatcher
git clone https://src.jayvii.de/pub/yt2rss.git
Home | Log | Files | Exports | Refs | Submodules | README | LICENSE | RSS

commit ead66bcbf3f68d7a28b7462f8c289418f3c53f1e
parent 6ce8ee0b2e628cedf7b1ed3bd334e6b0357b83cb
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sat, 10 Feb 2024 21:22:00 +0100

parse ampersand in channel names correctly

Diffstat:
Mindex.php | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/index.php b/index.php @@ -24,7 +24,12 @@ if (!is_null($_GET["channel"])) { ">\n<channel>\n"; $rss_xml = $rss_xml . "<docs>http://www.rssboard.org/rss-specification</docs>\n"; - $rss_xml = $rss_xml . "<title>" . $channel_xml["title"] . "</title>\n"; + $rss_xml = $rss_xml . "<title>" . + str_replace( + array("&"), + "&amp;", + $channel_xml["title"] + ) . "</title>\n"; $channel_id = str_replace( array("yt:channel:"), "", @@ -32,7 +37,12 @@ if (!is_null($_GET["channel"])) { ); $rss_xml = $rss_xml . "<link>https://www.youtube.com/channel/" . $channel_id . "</link>\n"; - $rss_xml = $rss_xml . "<description>" . $channel_xml["title"] . + $rss_xml = $rss_xml . "<description>" . + str_replace( + array("&"), + "&amp;", + $channel_xml["title"] + ) . "</description>\n"; $rss_xml = $rss_xml . "<pubDate>" . $channel_xml["published"] . "</pubDate>\n"; @@ -69,7 +79,12 @@ if (!is_null($_GET["channel"])) { // FIXME: fetch true description! $rss_xml = $rss_xml . "<description>" . $entry["link"]["@attributes"]["href"] . "</description>\n"; - $rss_xml = $rss_xml . "<itunes:author>" . $entry["author"]["name"] . + $rss_xml = $rss_xml . "<itunes:author>" . + str_replace( + array("&"), + "&amp;", + $entry["author"]["name"] + ) . "</itunes:author>\n"; $rss_xml = $rss_xml . "<pubDate>" . $entry["published"] . "</pubDate>\n";