<p>This is a response show to
<a href="https://hackerpublicradio.org/eps/hpr3959/index.html">hpr3959
:: Download any HPR series with english file names</a> "A dir with the
series name will be created and all shows will be renamed to
ShowTitle.mp3 inside it"</p>
<p>This was the first show by gemlog and he used Bash, sed, grep, wget,
to scrape the HPR site. This is great but as he points out any change to
the site will break the script.</p>
<p>A safer way to get the episodes is by scraping the rss feed, and the
following is an example of how you might do that</p>
<pre><code>#!/bin/bash

series_url=&quot;https://hackerpublicradio.org/hpr_mp3_rss.php?series=42&amp;full=1&amp;gomax=1&quot;
download_dir=&quot;./&quot;

wget &quot;${series_url}&quot; -O - | xmlstarlet sel -T -t -m &#39;rss/channel/item&#39; -v &#39;concat(enclosure/@url, &quot;&#x2192;&quot;, title)&#39; -n - | sort | while read episode
do
  url=&quot;$( echo ${episode} | awk -F &#39;&#x2192;&#39; &#39;{print $1}&#39; )&quot;
  ext=&quot;$( basename &quot;${url}&quot; )&quot;
  title=&quot;$( echo ${episode} | awk -F &#39;&#x2192;&#39; &#39;{print $2}&#39; | sed -e &#39;s/[^A-Za-z0-9]/_/g&#39; )&quot;
  wget &quot;${url}&quot; -O &quot;${download_dir}/${title}.${ext}&quot;
done</code></pre>
