Artwork

Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

HPR3959: Download any HPR series with english file names

 
Share
 

Manage episode 378487368 series 2795599
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Hello all. This is gemlog from Terrace, bc, canada just up near the alaska panhandle.

Some of you may know me from in COM chat on sdf dot org or as a fedizen on the tilde dot zone instance of mastodon.

Now, the other day I finally got around to checking out HPR properly, even though my masto-pal claw-dio-m turned me on to it a couple of years ago.

Recently, on a friday night in irc on tilde radio, I noticed there were whole series on hpr and not only single shows and that got me kind of excited.
I guess I'm easily excitable.

Anyhow, something I could listen to at work or while driving. Still, I managed to forget about it until /just/ before I was leaving the house for work on Monday morning. I rushed to copy over a few shows - nearly at random onto my phone and headed out to work.

After I got my morning sorted at work, I told VLC to play-all and enjoyed a couple of shows. I noticed that each show I had chosen had a beg post at the beginning. I figured I could make one on at least something from my messy gemlog/bin dir.

However, after a break, I came back and couldn't remember which 4 digit numbered dot mp3 I had finished up on, which mildly irked me. Well, as we all know, irk becomes itch and I put my sad regex skills to the test scraping the hpr website with a custom bash script later when I got home.

A very custom bash script. Like all scrapers, if any of the guys at hpr even breathe the wrong way, it will probably break horribly. On the other hand, I've had scrapers that looked just as sad running for many years against a canadian government site. So. Who knows?

All the script uses are some built-ins from bash along with sed and wget for the actual getting. My local instance of searX N G was left smoking as scrambled for sed incantations to string together. I'm not a sed guy.

Usage is simple, as the script only accepts one argument: ... the four digit series number of the show you want to download. It will create a dir with the series name and download every mp3 it finds, renaming each show to the show title.

I was tempted to doll it up with some niceties like options for download dir, a selector for a series with a dialog of some kind... yada yada yada.

But... we all know what happens when you stretch a quick hack with a bash script too far for the scripting language: hours of misery wishing you'd started with some other language.

So far, I've used the script to download 8 series. DU dash S H tells me they add up to 2 dot 2 gig, so it seems to work well enough.

It comes with the same iron clad warranty as everything I write:

If it breaks, you get to keep all the pieces. Thanks for listening.

#!/bin/bash # gemlog@gemlog.ca 2023-08-26 # License: CC BY-SA 4.0. # not proud of my continuing lack of regex foo frankly... if [ $# -lt 1 ]; then echo 1>&2 "$0: You need to enter the HPR Series Number to download as 4 digits" echo "The full list of HPR Series is at https://hackerpublicradio.org/series/index.html" exit 2 fi snumber=$1 re='^[[:digit:]]{4}$' if [[ $snumber =~ $re ]]; then wget https://hackerpublicradio.org/series/$snumber.html -q -O /tmp/$snumber.html content=$(]*>//g;/]*>//g;/]*>//g;/
  continue reading

63 episodes

Artwork
iconShare
 
Manage episode 378487368 series 2795599
Content provided by HPR Volunteer and Hacker Public Radio. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by HPR Volunteer and Hacker Public Radio or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

Hello all. This is gemlog from Terrace, bc, canada just up near the alaska panhandle.

Some of you may know me from in COM chat on sdf dot org or as a fedizen on the tilde dot zone instance of mastodon.

Now, the other day I finally got around to checking out HPR properly, even though my masto-pal claw-dio-m turned me on to it a couple of years ago.

Recently, on a friday night in irc on tilde radio, I noticed there were whole series on hpr and not only single shows and that got me kind of excited.
I guess I'm easily excitable.

Anyhow, something I could listen to at work or while driving. Still, I managed to forget about it until /just/ before I was leaving the house for work on Monday morning. I rushed to copy over a few shows - nearly at random onto my phone and headed out to work.

After I got my morning sorted at work, I told VLC to play-all and enjoyed a couple of shows. I noticed that each show I had chosen had a beg post at the beginning. I figured I could make one on at least something from my messy gemlog/bin dir.

However, after a break, I came back and couldn't remember which 4 digit numbered dot mp3 I had finished up on, which mildly irked me. Well, as we all know, irk becomes itch and I put my sad regex skills to the test scraping the hpr website with a custom bash script later when I got home.

A very custom bash script. Like all scrapers, if any of the guys at hpr even breathe the wrong way, it will probably break horribly. On the other hand, I've had scrapers that looked just as sad running for many years against a canadian government site. So. Who knows?

All the script uses are some built-ins from bash along with sed and wget for the actual getting. My local instance of searX N G was left smoking as scrambled for sed incantations to string together. I'm not a sed guy.

Usage is simple, as the script only accepts one argument: ... the four digit series number of the show you want to download. It will create a dir with the series name and download every mp3 it finds, renaming each show to the show title.

I was tempted to doll it up with some niceties like options for download dir, a selector for a series with a dialog of some kind... yada yada yada.

But... we all know what happens when you stretch a quick hack with a bash script too far for the scripting language: hours of misery wishing you'd started with some other language.

So far, I've used the script to download 8 series. DU dash S H tells me they add up to 2 dot 2 gig, so it seems to work well enough.

It comes with the same iron clad warranty as everything I write:

If it breaks, you get to keep all the pieces. Thanks for listening.

#!/bin/bash # gemlog@gemlog.ca 2023-08-26 # License: CC BY-SA 4.0. # not proud of my continuing lack of regex foo frankly... if [ $# -lt 1 ]; then echo 1>&2 "$0: You need to enter the HPR Series Number to download as 4 digits" echo "The full list of HPR Series is at https://hackerpublicradio.org/series/index.html" exit 2 fi snumber=$1 re='^[[:digit:]]{4}$' if [[ $snumber =~ $re ]]; then wget https://hackerpublicradio.org/series/$snumber.html -q -O /tmp/$snumber.html content=$(]*>//g;/]*>//g;/]*>//g;/
  continue reading

63 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide