Episode: 1935
Title: HPR1935: Quick Bashpodder Fix
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1935/hpr1935.mp3
Transcribed: 2025-10-18 11:19:47

---

This in HPR episode 1935 entitled Quick Mashable Fixed, it is hosted by Charles Nnj and
in about 10 minutes long, the summary is, Charles Nnj returns with a short show to discuss
a fix he made to Mashable.
This episode of HPR is brought to you by an honesthost.com, get 15% discount on all shared
hosting with the offer code HPR15, that's HPR15, better web hosting that's honest and
fair at an honesthost.com.
Hi, and welcome to Hacker Public Radio.
This is Charles Nnj and I'm back with a quick podcast for New Year's Day.
To tell you about a fix I found for a, an annoying bug where it is the bug to me in the
bash potter script for downloading audio podcasts and I guess other types of media files
as well from, from different feeds.
And here's the background.
I've been using bash potter, oh, I would say for five years or something like that, to
download my audio podcasts and it's been working fine except for two feeds that I subscribe
to and that's, and they're both concerning the TED Talks.
One is the TED Talk feed itself, the audio feed, I don't, if I need to see the video I can
go to YouTube.
The other is the NPR Digest show called the TED Radio Hour.
Both of these have feeds that give you back URLs that do not end in the file name but
end in a bunch of additional fields that are delimited by question marks in usual way.
And bash potter is, oh thank you train, that bash potter is downloading these and overlaying
the file names with the serial number or API key in the case of the TED Talks number for
the feed itself as opposed to the actual file name, something .mp3, I think it is, yeah
they're MP3 feeds, they're not Og.
In any case, I was a little annoyed with this so I wrote a little Python script to go and
fix the URLs that I wanted to, I wanted to download from those two feeds and I was going
to replace bash potter with an enhanced version of that until I decided to just look at the
code and it turns out that there's an easy fix that you can make to bash potter just
a few lines from the bottom in the middle of the wild loop as it's going through the list
of URLs that you've downloaded, it's doing a grip to see whether you've already downloaded
the resource at that URL in each case and if you haven't, if it's not there, then it
does a W get and it constructs the file name from the URL and it does this by picking
it out with a series of three calls to Og and in each case it either grabs the, it grabs
the file name if it's the last thing in the URL following a slash or the last thing in
a URL following an equal sign or if it's the last thing in the URL before the first question
mark and it takes that thing that it has stripped out and sends it in as the file name that it
wants to give to the resource that you're downloading. Now it goes and gets the audio files just
fine but if it's always grabbing the feed name from the URL to assign it to a disk file, it's
going to name every MP3 file 510298 or that other large incomprehensible number from the
TED feed. So all I did to fix this was I moved the final check for the Gramps URL, everything
from the URL before the first additional field. In other words, the last check I just moved
it to the front and now it's picking up my ordinary feeds just fine and it's picking up the it's
picking up the TED TED talk and TED radio our resources and giving them the correct names.
And then to make sure I got everything, I went into my podcast.log and deleted all of the URLs
that were stored there from previous runs of bashbotter over the years that related to those
two feeds and I got everything and it was all correctly named and everything. So that looks
like it's working. Now let's see that's about all I have to say. Your mileage may vary, there may be
some feeds where this won't work but I haven't identified those yet. And as a public service I'm going
to be forwarding the original bashbotter script, the stock version that I got from the website,
the new revise script that as I have it with only a one line change in the final WGet statement.
And an abbreviated BP.conf to show what the feeds that I'm using look like. The conf file
is a configuration file. It just gives the bashbotter script something to look for. And I also have an
abbreviated podcast.log to show what some of the URLs look like when they're passed to the script
and saved in the course of running bashbotter. So to make sure we won't download any shows that
you've already retrieved, it keeps the log of everything that is downloaded, including all the URLs.
And it matches those against the feed. Now this is the old school bashbotter.
Has long ago given you additional tweaks you can make, you can put comments in and control the
number of things that you download and all that sort of thing. But I decided to just stay
with the one that I was using and just make sure that it's working correctly for me.
I was going to contribute this change as a patch to the bashbotter site.
But I thought I would throw this out there because I don't know if they're interested in getting patches
since the version I have is pretty old. I think it's as of 2008 or something like that.
So thanks to the supporters of bashbotter. Those who put it out there and taught me how to use it.
It's pretty easy to use and with this fix it works for all of my feeds. So I'm pretty happy with it.
And I hope that this fix and the contributed resources will help some of you to use that instead of something
a lot more complicated than just more fraught with maintenance concerns like say the evil items or some other service
that's supposed to provide you with new content for your music player.
But if all you need are new files, then a script really ought to do it. And this is one of those scripts.
So thanks. I hope you all have a great new year. I won't be around for New Year's Eve or New Year's Day
because I have many, many things to do with family and elder care responsibilities and probably child care as well.
So that's it from here. Have a great day today and we'll see you in 2016.
Take care and goodbye from hacker public radio.
Tudels.
We are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by an HPR listener like yourself.
If you ever thought of recording a podcast and click on our contributing to find out how easy it really is.
Hacker Public Radio was founded by the digital dog pound and the Infonomicon Computer Club.
And it's part of the binary revolution at binrev.com.
If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow-up episode yourself.
Unless otherwise status, today's show is released on the creative comments, attribution, share a light, 3.0 license.
