2025-11-26 22:17:37 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
# cc-0
|
|
|
|
|
|
2025-11-26 22:37:54 +01:00
|
|
|
tmpdir=$(mktemp --directory /tmp/"$( basename ${0} ).XXXXXX" )
|
2025-11-26 22:17:37 +01:00
|
|
|
base="https://hackerpublicradio.org"
|
2026-01-09 17:29:41 +01:00
|
|
|
reportfile="${tmpdir}/report.txt"
|
2026-08-07 13:29:49 +02:00
|
|
|
echo "Checking feeds"
|
|
|
|
|
#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
|
|
|
|
|
for feed in comments.rss comments_rss.php hpr_mp3_rss.php hpr_mp3_rss.php?series=47 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_total_ogg_rss.php hpr_total_opus_rss.php hpr_total_rss.php rss-ccdnv1.php rss-future.php rss.php
|
2025-11-26 22:17:37 +01:00
|
|
|
do
|
2025-11-26 22:37:54 +01:00
|
|
|
tmpfile="${tmpdir}/${feed}"
|
2026-08-07 13:29:49 +02:00
|
|
|
wget --quiet "${base}/${feed}" --output-document="${tmpfile}"
|
2025-11-26 22:17:37 +01:00
|
|
|
if [[ ! -s "${tmpfile}" || -z "${tmpfile}" ]]
|
|
|
|
|
then
|
2026-08-07 13:29:49 +02:00
|
|
|
echo "The \"${tmpfile}\" variable/file is missing."
|
|
|
|
|
continue
|
2025-11-26 22:17:37 +01:00
|
|
|
fi
|
2026-08-07 13:29:49 +02:00
|
|
|
if [ "$( file --brief --mime-type "${tmpfile}" | grep --count 'xml' )" -ne "1" ]
|
2025-11-26 22:17:37 +01:00
|
|
|
then
|
2026-08-07 13:29:49 +02:00
|
|
|
echo "The \"${tmpfile}\" variable has not a valid \"text/xml\" mime type."
|
|
|
|
|
continue
|
2025-11-26 22:17:37 +01:00
|
|
|
fi
|
|
|
|
|
xmllint --format "${tmpfile}" >/dev/null 2>&1
|
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
|
then
|
|
|
|
|
echo "✗ The feed \"${base}/${feed}\" is not valid xml."
|
2026-08-07 13:29:49 +02:00
|
|
|
echo "Check file \"${tmpfile}\""
|
2025-11-26 22:17:37 +01:00
|
|
|
else
|
2026-08-07 13:29:49 +02:00
|
|
|
rm "${tmpfile}"
|
2025-11-26 22:17:37 +01:00
|
|
|
fi
|
|
|
|
|
done
|
2026-08-07 13:29:49 +02:00
|
|
|
echo "Finished Checking feeds"
|
2026-01-09 17:29:41 +01:00
|
|
|
# check_urls_in_file.bash
|
|
|
|
|
|
2026-08-07 13:29:49 +02:00
|
|
|
# read -p "Remove the feeds ? (Y|n) ? " -n 1 -r
|
|
|
|
|
# echo # (optional) move to a new line
|
|
|
|
|
# if [[ ! $REPLY =~ ^[Yy]$ ]]
|
|
|
|
|
# then
|
|
|
|
|
# echo "The files are available in \"${tmpdir}\"."
|
|
|
|
|
# else
|
|
|
|
|
# rm -v "${tmpdir}/*.*"
|
|
|
|
|
# fi
|