From f137117030e9c4c743ba876d3e8137798b9e92a6 Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Wed, 26 Nov 2025 22:17:37 +0100 Subject: [PATCH] Tool used to check rss feeds - rss feeds contain invalid xml #301 --- workflow/hpr-check-feeds.bash | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 workflow/hpr-check-feeds.bash diff --git a/workflow/hpr-check-feeds.bash b/workflow/hpr-check-feeds.bash new file mode 100755 index 0000000..8ad6a65 --- /dev/null +++ b/workflow/hpr-check-feeds.bash @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# cc-0 + +tmpfile=$(mktemp /tmp/"$( basename ${0} ).XXXXXX" ) +base="https://hackerpublicradio.org" +for feed in comments.rss comments_rss.php hpr_mp3.rss hpr_mp3_rss.php hpr_mp3_rss.php?series=47 hpr_ogg.rss hpr_ogg_rss.php hpr_ogg_rss.php?series=47 hpr_opus_rss.php hpr_opus_rss.php?series=47 hpr_rss_mp3.php hpr_rss.php hpr_spx.rss hpr.sql.rss hpr_total_mp3.rss hpr_total_ogg.rss hpr_total_ogg_rss.php hpr_total_opus_rss.php hpr_total_rss.php hpr_total_spx.rss rss-ccdnv1.php rss-future.php rss.php +do + wget --no-verbose "${base}/${feed}" --output-document="${tmpfile}" + if [[ ! -s "${tmpfile}" || -z "${tmpfile}" ]] + then + echo "The \"tmpfile\" variable/file is missing." + fi + if [ "$( file --brief --mime-type "${tmpfile}" | grep --count 'text/xml' )" -ne "1" ] + then + echo "The \"tmpfile\" variable has not a valid \"text/xml\" mime type." + fi + xmllint --format "${tmpfile}" >/dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "✗ The feed \"${base}/${feed}\" is not valid xml." + else + echo "🗸 The feed \"${base}/${feed}\" is valid xml." + fi + rm "${tmpfile}" +done