I want to write a script to download all Walter Lewin lectures from this page in wmv format: http://videolectures.net/mit801f99_physics_classical_mechanics/

However the links to the wmv file for example for the first lecture: http://videolectures.net/mit801f99_lewin_lec01/ change when one reloads the page.

So is it possible to write a script which downloads the lectures one after the other automatically in wmv format. How can one do this?

I tried wget -A wmv -r http://videolectures.net/mit801f99_physics_classical_mechanics/


httrack "http://videolectures.net/mit801f99_physics_classical_mechanics/" -O ~/VideoLecture "-*" "+*.wmv"

both didn't work.

Note: This question emerged from the following question on physics sx: https://physics.stackexchange.com/questions/38033/walter-lewin-lectures-in-hd

for i in `seq -w 1 35`; do wget -p -U Mozilla -A wmv -r  "http://videolectures.net/mit801f99_lewin_lec$i/"; done

seems to work. But I think think there must be a more elegant way to do it.

  • Why do you think that this is not elegant? – Nils Oct 21 '12 at 20:04
  • Because it takes a long time and produces a lot of output to stdout until it finds the first wmv video and downloads it... Furthermore it doesn't load multiple videos parallel and one cannot pause and resume the download process... – Julia Oct 22 '12 at 13:18

You have to parse the download-page. Disable scripting in your browser and open the web-page-source code.

When I do this, I see the following "interesting" part:

<img alt="Download Video" src="http://media.videolectures.net/rel.1350055487/icons/download.png" />
Download&nbsp;<a href='http://videolectures.net/site/secure_dl/eea58431dcc3454ad91ef7c89a49958b/50845240/afuvgg7fochnsdyl2ee4hlcsvwamqha2/tag=23313/mit801f99_lewin_lec01_01.wmv' rel='nofollow'>mit801f99_lewin_lec01_01.wmv</a>&nbsp;<small>(Video 336.5 MB)</small>

Now this is

  1. Download main-page
  2. Remember cookies
  3. Parse page - look for download, lec01_*.wmv
  4. Use the found URL with the remembered cookies to download the wmv-file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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