Created
January 5, 2016 14:58
-
-
Save ScottDillman/96c316b3b23a09f88997 to your computer and use it in GitHub Desktop.
Download Indoor Kids podcasts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import re | |
import subprocess | |
## settings, could make these all command line args | |
## if it is worth it | |
## get everything after this | |
last_ep = 217 | |
## rss feed for podcast | |
rss_feed = 'http://theindoorkids.libsyn.com/rss' | |
base_url = 'http://traffic.libsyn.com/theindoorkids/' | |
url_search_str = 'IK[0-9]+.*\\.mp3' | |
ep_search_str = '^IK([0-9]+)' | |
print("Opening Feed [%s]" % rss_feed) | |
print("Grabbing freeds after episode [%d]" % last_ep) | |
print("Downloading from base url [%s]" % base_url) | |
URL=urllib2.urlopen(rss_feed) | |
for i in re.findall(url_search_str, URL.read(), re.I): | |
result = re.findall(ep_search_str,i,re.I) | |
print(i) | |
try: | |
ep = int(result[0]) | |
if(ep > last_ep): | |
print("Downloading episode [%d]" % ep) | |
subprocess.call(["youtube-dl", "%s%s" % (base_url,i)]) | |
except ValueError: | |
print 'Episode is not numeric...' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment