Files
hpr-knowledge-base/hpr_transcripts/hpr4398.txt

144 lines
9.1 KiB
Plaintext
Raw Normal View History

Episode: 4398
Title: HPR4398: Command line fun: downloading a podcast
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4398/hpr4398.mp3
Transcribed: 2025-10-26 00:14:41
---
This is Hacker Public Radio Episode 4398 for Wednesday 11th of June 2025.
Today's show is entitled, Command Lying Fun.
Downloading a podcast, it is hosted by Kevvie, and is about 11 minutes long.
It carries a clean flag.
The summary is, Kevvie goes through how to download from an RSS feed from the command.
Hello, hello and welcome to another episode of Hacker Public Radio.
I'm Kevvie from the TuxJump podcast, and today I want to actually do a wee bit of a continuation
from the short series I did earlier on this year between December and January, about recording
audio on the command line.
But this time, instead of recording audio, I'm going to show how you can take an RSS feed
and either get the most recent file from it, or download every file that's contained
in the RSS feed.
Be careful with that second one, sometimes those can be huge.
So you may be asking why, why do this?
It's because we can, it's something else to do from the command line.
I love learning the command line, and this is especially useful for anybody who maybe
has an older computer and they don't want to bulk it up with more applications or somebody
with very limited space, you will need to download nothing here, there is no programs.
This all should come with standard Linux command line tools.
So like I said, there shouldn't be any need for the majority of people unless you're running
a really bare-boned system to install anything, right?
So let's start with the basics.
So what are we going to use?
Well, first of all, we're going to get the curl command and then put the feed after
it, and that essentially is just going to grab all the information it can.
And then we'll use the grep command.
Now the grep is simply going to search all that and you're going to tell it to look for
the specific file extension.
So if for example, you want to download the latest MP3, you would have to put an MP3
or org or flag whatever it is, you just have to give it the extension that you want.
And then we're going to put a wheat tag on the end, which is going to say just do the
newest.
So we'll do the head command for that with the parameter dash 1.
So if to put this all together, now once you've got all that, we're going to use WGate
to actually download the file.
So let's start this.
Don't worry if you're not going to be able to follow on, I'm going to put all these links
and examples in the show notes.
So you just start with WGate and then we are going on to put our back tick.
So that's the one that looks like an inverted comma, but it's almost like it's pointing
by webit backwards.
So it's at a 40 degree 45 degree angle roughly.
So WGate, then a back tick and then curl, then we need to put an RSS feed.
So whatever that is, you're going to need to put that in there.
So then the pipe and then we're going to create and then dash O and then single inverted
comma and then we're going to put HTTPS and then we want to make sure that this catches
everything.
That's the risk on it and then cool on forward slash forward slash, then we do an open
square bracket and then the carrot, which is the we symbol, which is pointing upwards.
It's like a we arrow pointing upwards.
Then the quotation marks, a double inverted comma and then close square brackets, ask
this again and then this is where you want to put in your file extension.
So if it's MP3, Og, Flak, you put it in there and then a single inverted comma.
Then we'll put in the pipe command again and we'll put in head dash one.
Now it's quite important to do this because if you don't do that, it'll end up continually
downloading a bunch of files.
You don't want that.
And then you're just simply putting the another backtick to close off, okay?
So if for example, you were wanting the latest episode of Tuxjam, simply you would get
WGate, Backtick Curl and then HTTPS, cool on forward slash forward slash Tuxjam dot
other side.net work forward slash feed, forward slash podcast and then the pipe and then
grip dash O and then now the default for Tuxjam is the Og feed.
So you would just then put inverted comma, HTTPS, asterisk, cool on forward slash and
then your square bracket, your carrot, your quotation mark, close square bracket, dash
Og, single inverted comma and then pipe and then head dash one and then your backtick,
okay?
And that will get you the most recent episode of Tuxjam.
So you could do this with, like I said, do this with any feed, I've tried it out with
it's worth no problem with MP3 feeds with Og feeds and with Flak feeds.
Now that one was no problem, however, if you want to download the whole feed, no, be careful
although I will say as well, I can't, I'm saying to be careful, most feeds, if they run
if huge will cap out at some point.
So it chances that if you've got a podcast with thousands of shows, then this won't actually
work because it'll probably be limited to the last hundred or so unless you go for a specific
feed.
So we're going to use a similar command, but this time we need to tweak it a wee bit,
okay?
So again, we're just going to use the curl and the feed again and then we're going to use
grip, but this time we want to we parameter here, we want to put a capital E after the
dash.
So instead of just dash, oh, it's capital E dash capital E and then oh, and then you're
putting in all the same, but then now this is what threw me the first few times because
I was getting a lot of duplicates when I was trying this out and somebody recommended
that I use the sort dash you command and what that does is even if the feeds actually
throwing up some duplicates, it'll say to ignore it.
And also we want to be, it's one after the other after the other.
So for that, we're going to use the Zarynx command, which is XARGS, again, nothing to install,
it's all just right there.
So again, they will just go through it.
So it's if you are going to do, if you wanted to download every episode of TuxJamp, it
would be WGate and then the back tick and then curl HTTPS colon forward slash forward
slash TuxJamp dot other side dot network forward slash feed forward slash podcast and then
the pipe, which is just a vertical line and then grip, then dash capital E O and then
inverted comma, HTTPS, asterisk, colon forward slash forward slash open square bracket,
the carrot and quotation marks, closed square brackets, asterisk log, a inverted comma
and then the pipe and then sort dash U, lowercase U and the pipe and then ZARGS XARGS and then
the back tick.
Now, if you want to, if you're going to use this, whenever you add in the terminal, this
way, it's going to download the file to however you might not necessarily want that, especially
if you're going to do this with something like let's just say you're creating a script
for checking your checking a feed weekly or monthly or whatever and you're going to use
a Chrome tab, you want to actually be quite specific as to where the scores.
So after WGate, if you do dash capital P, then you can stipulate what directory you wanted
in.
So that goes in after WGate and before the back tick, so you would put that in there.
So WGate dash P and then you could just specify whatever directory you wanted, it's entirely
up to you.
So that just keeps the places nice and nice and clean and it also ends up if you do have
an accident like I did with one of the feeds where I had put in the wrong a slight change
of the command and I ended up with a, it started downloading everything, I ended up with
a folder full of HTML files and everything because I had actually forgot to put the file
extension on it.
So I hadn't specified org and I was like, why is this folder fully up very rapidly?
So remember if you do that on, I mean, this is pretty basic, basic stuff, but it's just
in case you don't know it.
If you do something like that from the command line, control C will kill a command.
So if you're watching it, downloading a pile of stuff, control C, it's an awful lot
clean out on it, make sure it stops the command rather than just killing the terminal window.
So right, okay, again, one of these things, it's there because we can, it's good just
to geek out on the command line at times.
And if Linux is good for nothing else, then surely it's good for getting a bit more
plain about it with some command line love.
So yeah, so if you've got any ideas for something that maybe you do that is not common practice
on the command line, why not do I show like this and record it?
Because of course, hacker public radio, it's community based as well, you know, so it
needs shoes to survive.
So that's all from me today.
This has been Kavi, June and tomorrow for another great episode of Hacker Public Radio.
You have been listening to Hacker Public Radio at Hacker Public Radio does work.
Today's show was contributed by a HBR listener like yourself.
If you ever thought of recording podcasts, click on our contribute link to find out how
easy it leads.
The hosting for HBR has been kindly provided by an honesthost.com, the internet archive
and our things.net.
On the Sadois status, today's show is released under Creative Commons, Attribution 4.0 International
License.