Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to download a mp3 file from an online course. But the file is behind a CGI redirect. The URL is: "http://openmedia.yale.edu/cgi-bin/open_yale/media_downloader.cgi?file=/courses/fall08/chem125/mp3/chem125_01_090308.mp3"

wget returns "no file available for download". I tried curl -L and wget --trust-server-names and wget -content-disposition.

share|improve this question
2  
I get that same error when visiting the site in my browser. –  BenjiWiebe Feb 23 '13 at 2:51

2 Answers 2

You will need to understand a bit more about what the CGI is doing. If I click on that link, from SuperUser, I get the same message. The problem is not with the CLI per-se, its because the CGI is detecting you are accessing the file directly and it has been setup to block this (my guess anyway). Try to use the wget --referer option to set the referer. If that doesn't work simply iterate constantly making wget more "same-same" as your browser, meaning adding in the user agent and so forth.

Note: I'm assuming this file is not behind some kind of system you need to log into. If it is you probably need to look at a small python script (or similar) to achieve this, although there are some tools if scripting is not your bag.

Note: what you are doing may not be legal depending on the terms of service of the site and the license the file is distributed under.

share|improve this answer
    
If a login is required and a browser cookie is used, it can be easily exported and used with Wget. –  Karan Feb 23 '13 at 18:14
    
What I am doing is legal and there is no login. The file is an audio recording of a course from Yale. Chem There are about 30 files, one for each class, that I want so I thought to write a script. I am guessing they put the CGI in there to prevent someone like myself from doing what I am trying to do. :( I tried wget --referer=http://oyc.yale.edu/chemistry/chem-125a --user-agent="Chrome 9.5 Gecko 1.7" http://openmedia.yale.edu/cgi-bin/open_yale/media_downloader.cgi?file=/courses/f‌​all08/chem125/mp3/chem125_01_090308.mp3 also and that did not work. –  Beaker McChemist Feb 28 '13 at 19:10

I have a script hosted on GoogleCode that solves this exact problem.

share|improve this answer
1  
Please add more detail about how this script works, or representative code, or at least usage information. –  Kazark Apr 1 '13 at 21:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.