/ / News

Joe sez, “Hey Cory- Took your advice from little brother and started to teach
myself Python. I wrote my first little script which downloads your
complete podcast archive(see below). I did this after finding out the
iTunes feed was incomplete, and severely needing a Doctorow fix. I
was hoping you could share the script with some of the listeners who
might find themselves a smiler situation.”

Script tested in python 2.7

--------------------------------------------------------------
import os
from urllib2 import urlopen, URLError, HTTPError

def dlfile(url):
    # Open the url
    try:
        f = urlopen(url)
        print "downloading " + url
        # Open our local file for writing
        with open(os.path.basename(url), "wb") as local_file:
            local_file.write(f.read())
    #handle errors
    except HTTPError, e:
        print "HTTP Error:", e.code, url
    except URLError, e:
        print "URL Error:", e.reason, url

def main():
    # Iterate over image ranges
    for index in range(1, 160):
        url = ("http://www.archive.org/download/"
               "Cory_Doctorow_Podcast_%d/"
               "Cory_Doctorow_Podcast_%d_64kb_mp3.zip" %
               (index, index))
        dlfile(url)
if __name__ == '__main__':
    main()