shk3/edx-downloader — pull request #136 by Coiby (2014-12-09 12:10:38+00:00)
Title: cdn video downloads, seperate folder for each week... 

1. CDN video downloads
a. By default, download video from CDN first. If no link found, then use youtube-dl instead. (Youtube is blocked in some countries like China:(, so I make this a first option. And most of courses host videos on CDN.)
b. Use "-nc" or "--no-cdn" to disable this option.

2. Create seperate folder for each week
Many courses have too many videos in a module. It's better not to put all files into one folder. Directory structure(course "GG101x The Science of Happiness") now looks like this,
.
├── How to Navigate this Course
│ ├── 01-Intro to edX Video.mp4
│ ├── 01-Intro to edX Video.srt
│ ├── 02-Courseware Video.mp4
│ ├── 02-Courseware Video.srt
│ ├── 03-Navigation.mp4
│ ├── 03-Navigation.srt
│ ├── 04-Discussion.mp4
│ ├── 04-Discussion.srt
│ ├── 05-Summary.mp4
│ └── 05-Summary.srt
├── Week 10 WrapUp
│ └── 01-Video Chat with Emiliana Simon-Thomas and Dacher Keltner.mp4
├── Week 1 Introduction to the Science of Happiness
│ ├── 01-What Makes You Happy.mp4
│ ├── 01-What Makes You Happy.srt
│ ├── 02-Welcome from the Instructors.mp4
│ ├── 02-Welcome from the Instructors.srt
│ ├── 03-Check-Ins Explained.mp4
...

3. Extracting filenames from ```

```
h2 element gives names that make more sense. Vidoes on youtube have names like edX-FA12-cware-4_100(https://courses.edx.org/courses/course-v1:BerkeleyX+GG101x-2+1T2015/courseware/1ff96c6155eb40c39140c656cdc2708b/fe61eec71862458eb2526dbace127fb4/), RICADBIOT314-V004400_100(https://courses.edx.org/courses/RiceX/AdvBIO.2x/2014T3/courseware/87f77ac155d749bcbb4a41bf1327502e/e56fccd2e69f4d3bb9dd4df929034624/).

Other changes:

4. Catch exception when using youtube-dl
If youtube-dl isn't installed, pass the exception and continue.

5. Extract video section from div(class=xmodule_VideoModule) which make it easier to extract CDN download links.