9

given a podcast rss feed, how can I download the complete podcast from the commandline ?

I am not looking for a full-blown, command line, podcast client. I just need a one time command to download a complete history (all episodes) of a given podcast in mp3.

As an example, here is a rss feed containing close to 200 episodes:

http://www.internethistorypodcast.com/feed/

How can I download all of them as mp3 files ?

4 Answers 4

17

youtube-dl can do it.

Just pass the URL of the feed as the only argument.

2
  • 1
    this does work - I just used it to download a radio program we get from the US May 8, 2021 at 3:14
  • This program is just a blessing! A gift that keeps on giving.
    – Suuuehgi
    Aug 11, 2022 at 21:55
4

From this post:

URL="https://feeds.feedburner.com/TEDenEspanol"
curl -s $URL | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m './/enclosure' -v '@url' -n | wget -i -
  • curl gets XML from URL
  • xmlstarlet extract enclosure URL from XML
  • wget download list of URL from STDIN

If you don't want to download all the links, wget is not needed.

To get for example the title:

curl -s $URL | xmlstarlet sel -t -v 'rss/channel/title'
2

Try this, it works fine for me:

$ curl http://www.internethistorypodcast.com/feed/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*mp3" | sort -u | xargs wget
  • curl collects the raw podcast
  • grep extracts mp3 URLs
  • sort removes duplicate (in this case, I think it is the same as uniq)
  • xargs pipes the mp3 URLs one by one to wget
  • wget downloads the mp3 files one by one in the current folder
1
  • You'll probably get more upvotes if you provide a short explanation of why it works. Aug 15, 2021 at 19:09
0

I'm not really familiar with rss feeds or the format that they come in. Neither do I see, using newsbeuter for instance, the close to 200 episodes that you say are present in the feed (I see only 10 articles).

But if the mere purpose is to download the .mp3-files mentioned in the feed-file(s), this may work for you:

wget http://www.internethistorypodcast.com/feed/ -O feed
wget $(grep -ioP '<enclosure\s+url="\K.*?\.mp3(?=")' feed)

The first command downloads the feed-file(s), and saves it/them as feed. The second extracts .mp3-filenames from enclosure-tags in the feed-file(s) and downloads them.

Note: I just had a look at the website, and I wasn't able to find a complete feed/dowload list. The absence thereof may be intentional, and in that light I don't think it would be proper for me to explain how to crawl the site itself to extract/download all podcasts.

1
  • be careful with the -O flag as it doesn't rename a file but puts all output from wget into that file. This means if you download more than one file with wget all those files will be compressed together into that one file. Jan 20, 2019 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .