m1gin 362

List episodes from a podcast rss using xmllint command line tool

rss="https://mbirgin.com/userfiles/Enlem_ve_Boylam_RSS.xml";
raw=$(curl -s "$rss" | sed 's|xmlns=".*"||g');
count=$(echo $raw | xmllint --xpath "count(//rss/channel/item)" -);
for (( c=1; c<=$count; c++ ));
do
#echo $raw | xmllint --xpath "/descendant::item[$c]" -
title=$(echo $raw | xmllint --xpath "(//rss/channel/item/title/text())[$c]" - );
murl=$(echo $raw | xmllint --xpath "string((//rss/channel/item/enclosure)[$c]/@url)" - );
echo "$c: $title : $murl";
done;


#xmllint #clixml #ubuntu #commandline #linux #parsexml #bash

Add to: