Download files linked in a RSS feed

wget -q -O- http://example-podcast-feed.com/rss | grep -o "<enclosure[ -~][^>]*" | grep -o "http://[ -~][^\"]*" | xargs wget -c
This script can be used to download enclosed files from a RSS feed. For example, it can be used to download mp3 files from a podcasts RSS feed.
Sample Output
$ wget -q -O- http://parisdjs.libsyn.com/rss | grep -o "<enclosure[ -~][^>]*" | grep -o "http://[ -~][^\"]*" | xargs wget -c
--2013-09-24 17:33:29--  http://traffic.libsyn.com/parisdjs/Karl_Hector-Soul_Sauvage_d_Afrique_Vol_2.mp3
Resolving traffic.libsyn.com (traffic.libsyn.com)... 204.16.245.39
Connecting to traffic.libsyn.com (traffic.libsyn.com)|204.16.245.39|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ec.libsyn.com/p/d/4/0/d40ada743827718e/Karl_Hector-Soul_Sauvage_d_Afrique_Vol_2.mp3?d13a76d516d9dec20c3d276ce028ed5089ab1ce3dae902ea1d01c08737d2c85b33b2&c_id=6161475 [following]
--2013-09-24 17:33:30--  http://ec.libsyn.com/p/d/4/0/d40ada743827718e/Karl_Hector-Soul_Sauvage_d_Afrique_Vol_2.mp3?d13a76d516d9dec20c3d276ce028ed5089ab1ce3dae902ea1d01c08737d2c85b33b2&c_id=6161475
Resolving ec.libsyn.com (ec.libsyn.com)... 68.232.34.133
Connecting to ec.libsyn.com (ec.libsyn.com)|68.232.34.133|:80... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 69569861 (66M), 68359815 (65M) remaining [audio/mpeg]
Saving to: ?Karl_Hector-Soul_Sauvage_d_Afrique_Vol_2.mp3?

0
By: talha131
2013-09-24 12:38:08

3 Alternatives + Submit Alt

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: