Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read config from the cgf file with profiles not from config.py file #15

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,11 @@ pip-log.txt

# Mac crap
.DS_Store

# IntelliJ IDEA files
*.iml
.idea
atlassian-ide-plugin.xml

# other
*.patch
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,59 @@ Optionally set another options in `config.py` like `writesubtitles` to enable su

### Usage:

+ `python edx_dl.py`
+ `python edx_dl.py c:\Users\MyUser\Lectures\`
+ `python edx_dl.py --interactive c:\Users\MyUser\Lectures\`
```
usage: edx_dl.py [-h] [-u USERNAME] [-p PASSWORD]
[-c <course name> [<course name> ...]]
[-w <week number> [<week number> ...]]
[-f [<configuration file>]] [-r PROFILE] [-d DESTDIR]
[-i | -g]
[<dest_dir deprecated>]

Make courses from EdX powered courses available offline.

positional arguments:
<dest_dir (deprecated)>
destination directory; deprecated, use --destdir
option)

optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
username (if omitted search in profile file, then
.netrc used)
-p PASSWORD, --password PASSWORD
users password
-c <course name> [<course name> ...], --courses <course name> [<course name> ...]
one or more course names (better use course id from
the url e.g. "M101" for 10gen or "CS188.1x" for EdX )
-w <week number> [<week number> ...], --weeks <week number> [<week number> ...]
one or more weeks; -c must be present and specify only
one course
-f [<configuration file>], --config-file [<configuration file>]
configuration file to use
-r PROFILE, --profile PROFILE
download profile ("10gen", "edx" etc...), must present
as a section in the configuration file
-d DESTDIR, --destdir DESTDIR
destination directory for downloaded content
-i, --interactive run in interactive mode; cannot use with --gui
-g, --gui show GUI menu to choose course(s)/week(s) for
download; cannot use with --interactive
```

Please note that `--gui` and `-w` options are not implemented yet.
Also positional argument `dest_dir` will be removed in future version.
You can still define configuration in `config.py` but it will be removed later or sooner so switch to using `-f` and `-r` options ASAP.
Sample file config.cfg contains 10gen and edx profiles for 10gen.com and edx.org educational sites.
No quotes needed while defining EMAIL and PASSWORD in cgf file.

####Examples:
Download all open cources from EdX to directory /home/edu/edx-moocs:
```
python edx_dl.py -f config.cfg -r edx -d /home/edu/edx-moocs
```

Download only M101J (Mongo for Java Developers) from 10gen and manually confirm weeks/chapters to download:
```
python edx_dl.py -f config.cfg -r 10gen -c M101J -i
```
54 changes: 54 additions & 0 deletions config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#10gen config
[10gen]
[email protected]
PASSWORD=password
DOMAIN=education.10gen.com
#YDL_PARAMS = {}

#EdX.org config
[edx]
[email protected]
PASSWORD=password
DOMAIN=courses.edx.org
#YDL_PARAMS = {}


[DEFAULT]
YDL_PARAMS = {
'consoletitle': False,
'continuedl': True,
'forcedescription': False,
'forcefilename': False,
'forceformat': False,
'forcethumbnail': False,
'forcetitle': False,
'forceurl': False,
'format': None,
'format_limit': None,
'ignoreerrors': False,
'listformats': None,
'logtostderr': False,
'matchtitle': None,
'max_downloads': None,
'nooverwrites': True,
'nopart': False,
'noprogress': False,
'outtmpl': u'%(id)s.%(ext)s',
'password': None,
'playlistend': -1,
'playliststart': 1,
'prefer_free_formats': False,
'quiet': False,
'ratelimit': None,
'rejecttitle': None,
'retries': 10,
'simulate': False,
'skip_download': False,
'subtitleslang': None,
'updatetime': True,
'usenetrc': False,
'username': None,
'verbose': True,
'writedescription': False,
'writeinfojson': False,
'writesubtitles': False}
Loading