My script for downloading PDC09 presentations

So Microsoft PDC for 2009 was some time ago. On the site are videos of presentations which are available for download. Having short-listed the presentations that interested me (and it turned out to be all of them), I decided to download the videos and view them at a later date. I had two choices:
1. For each link, right click and chose “Save Target As”
2. Find some script to download all videos.

My decision was to find some script to download all the videos. Microsoft does provide a script via a batch file. You need to install cRUL; however my personal decision is to move away from batch files. I could not find any other script online so I decided to create one myself.

 Leverage my python skills I created the following script.

class DownloadFiles:
            def init(self):
            self.dic_downloaded_files = {}
            self.fname = “”
         def download_files(self):
            for line in open(self.fname):
                linesplit = line.split()
                 wgetCommand = “wget” + ” ” + “–output-document=” + linesplit[0]+ “.wmv” + ” ” +
linesplit [1]
                       os.system(wgetCommand)

def run(self,argv):
            self.init()
            if “-f” in argv:
                        self.fname = argv[1]
                        print “file name : ” + self.fname
            else:
                        print “No file in command line”
                        sys.exit(2)

self.download_files()

            if __name__ == “__main__”:
            DownloadFiles().run(sys.argv[1:])

 

This script uses the GNU wget.This script parses a text file containing

  • The name of the file when it has been downloaded to disk(linespilt[0]). On the pdc website the name of videos have the name like “CL11”. I want a descriptive name so I can know what this video will be presenting.
  • the url of the video I want to download (linesplit[1]) and the name of the file
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s