June 2, 2023

Binary Blogger

Are you a 1 or a 0? News, Thoughts and Reviews

Python Apps – Podcast RSS Downloader

2 min read

This year I am expanding my skillsets I have latched on to learning Python. For starters, my apps are small, utility type of projects that I can use on a regular basis. Sure I could go through the courses and build the games, but I am never going to build a game outside a lesson. I prefer to build things I can use.

One of the first ones I made was an RSS reader. I then expanded it to use it as an RSS downloader then as a full archive script for my Security In Five podcast. I then beefed it up to make it applicable to any RSS feed.

Here’s how it works.

Note – I am a Python noob so how I built it may not be ‘best practice’ in certain areas or other methods are more preferred than how I did it.

You can find the code on my Git repo – https://github.com/securityinfive/RSSDownloader

I built it using Python 3.7.

Here are the modules you will need

import wget
import feedparser
import glob
import os

Update these variables with your RSS target and a folder you want to save the mp3s from the feed to. Right now it’s one RSS feed. I may expand it to pull it from a file where you could have multiple RSS feeds to pull from at the same time.

RSS_Target = "https://securityinfive.libsyn.com/rss"
local_target_dir = "F:\SecurityInFive Archive"

When you run the script it will check the length of the RSS feed and ask the user for how many recent episodes to download. The RSS feeds are ordered most recent first. Enter 0 to download them all.

Then the script will read the RSS feed and look for .mp3 files in the URLs. After stripping out the mp3 file name, so it can use it to see if it has already been downloaded locally, the script then downloads all the new episodes. It will skip if the file already exists.

Here’s what it looks like when it runs (I already see a bug to fix ‘Downloading 0 file(s)’ it should say ALL of it’s 0).

I tested it on several podcast RSS feeds and it worked just fine. So if you want the files local to listen on an offline MP3 player or archive your favorite podcast this will work to mass download them. You can easily alter the script to get them all and automate it and run it daily.

End of line.

 

Please follow and like us:
Pin Share
Copyright © All rights reserved. | Newsphere by AF themes.

Enjoy this blog? Please spread the word :)

  • RSS
  • Follow by Email
  • Twitter
    Visit Us
    Follow Me
  • YOUTUBE
  • INSTAGRAM
RSS
Follow by Email
Twitter
Visit Us
Follow Me
YOUTUBE
INSTAGRAM