cs-dlp


Namecs-dlp JSON
Version 0.12.0b0 PyPI version JSON
download
home_pageNone
SummaryScript for downloading Coursera.org videos and naming them.
upload_time2023-06-15 22:56:15
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseGNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
keywords moocs coursera coursera-dl download education video
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            # cs-dlp

This is a fork of [coursera-dl](https://github.com/coursera-dl/coursera-dl) that works with modern Python and modern coursera.org, with added features and patches.

<!-- [![Build Status](https://travis-ci.org/coursera-dl/coursera-dl.svg?branch=master)](https://travis-ci.org/coursera-dl/coursera-dl) -->
<!-- [![Build status](https://ci.appveyor.com/api/projects/status/3hru0ycv5fbny5k8/branch/master?svg=true)](https://ci.appveyor.com/project/balta2ar/coursera-dl/branch/master) -->
<!-- [![Coverage Status](https://coveralls.io/repos/coursera-dl/coursera-dl/badge.svg)](https://coveralls.io/r/coursera-dl/coursera-dl) -->
<!-- [![Latest version on PyPI](https://img.shields.io/pypi/v/coursera-dl.svg)](https://pypi.python.org/pypi/coursera-dl) -->
<!-- [![Code Climate](https://codeclimate.com/github/coursera-dl/coursera-dl/badges/gpa.svg)](https://codeclimate.com/github/coursera-dl/coursera-dl) -->

<!-- TOC -->

- [Coursera Downloader](#coursera-downloader)
- [Introduction](#introduction)
- [Features](#features)
- [Disclaimer](#disclaimer)
- [Installation instructions](#installation-instructions)
    - [Recommended installation method for all Operating Systems](#recommended-installation-method-for-all-operating-systems)
    - [Alternative ways of installing missing dependencies](#alternative-ways-of-installing-missing-dependencies)
        - [Alternative installation method for Unix systems](#alternative-installation-method-for-unix-systems)
        - [ArchLinux](#archlinux)
        - [Installing dependencies on your own](#installing-dependencies-on-your-own)
    - [Docker](#docker)
    - [Windows](#windows)
    - [Create an account with Coursera](#create-an-account-with-coursera)
- [Running the script](#running-the-script)
    - [Resuming downloads](#resuming-downloads)
- [Troubleshooting](#troubleshooting)
    - [China issues](#china-issues)
    - [Found 0 sections and 0 lectures on this page](#found-0-sections-and-0-lectures-on-this-page)
    - [Download timeouts](#download-timeouts)
    - [Windows: proxy support](#windows-proxy-support)
    - [Windows: Failed to create process](#windows-failed-to-create-process)
    - [SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure](#sslerror-errno-1-_sslc504-error14094410ssl-routinesssl3_read_bytessslv3-alert-handshake-failure)
    - [Alternative CDN for `MathJax.js`](#alternative-cdn-for-mathjaxjs)
- [Reporting issues](#reporting-issues)
- [Filing an issue/Reporting a bug](#filing-an-issuereporting-a-bug)
- [Feedback](#feedback)
- [Contact](#contact)

<!-- /TOC -->

# Introduction

This script makes it easier to batch download lecture resources (e.g., videos, ppt,
etc) for [Coursera](coursera.org) classes.  Given one or more class names,
it obtains week and class names from the *lectures* page, and then downloads
the related materials into appropriately named files and directories.

This work was originally inspired in part by [youtube-dl][3] by which
I've downloaded many other good videos such as those from Khan Academy.


# Features

* Support for all kinds of courses (i.e., "Old Platform"/time-based as
    well as "New Platform"/on-demand courses).
* Intentionally detailed names, so that it will display and sort properly
    on most interfaces (e.g., VLC or MX Video on Android devices).
* Regex-based section (week) and lecture name filters to download only
    certain resources.
* File format extension filter to grab resource types you want.
* Default arguments loaded from `coursera-dl.conf` file.
* Core functionality tested on Linux, Mac and Windows.

# Disclaimer

`cs-dlp` is meant to be used only for your material that Coursera gives
you access to download.

We do not encourage any use that violates their [Terms Of Use](https://www.coursera.org/about/terms).
A relevant excerpt:

> "[...] Coursera grants you a personal, non-exclusive, non-transferable
> license to access and use the Sites. You may download material from the
> Sites only for your own personal, non-commercial use. You may not
> otherwise copy, reproduce, retransmit, distribute, publish, commercially
> exploit or otherwise transfer any material, nor may you modify or create
> derivatives works of the material."


# Installation instructions

`cs-dlp` requires Python 3 and a Coursera account enrolled in the class of interest.

**Note:** `cs-dlp` is not compatible with Python 2.

On any operating system, ensure that the Python executable location is added
to your `PATH` environment variable and, once you have the dependencies
installed (see next section), for a *basic* usage, you will need to invoke
the script from the main directory of the project and prepend it with the
word `python`.  You can also use more advanced features of the program by
looking at the "Running the script" section of this document.

*Note:* You must already have (manually) agreed to the Honor of Code of the
particular courses that you want to use with `cs-dlp`.

## Installing from source

From a command line (preferably, from a virtual environment), simply issue
the command:

    git clone https://github.com/raffaem/cs-dlp
    cd cs-dlp
    pip install --user .

**Note 1:** We strongly recommend that you *don't* install the package
globally on your machine (i.e., with root/administrator privileges), as the
installed modules may conflict with other Python applications that you have
installed in your system. Prefer to use the option `--user` to `pip install`.

### ArchLinux

`cs-dlp` does not currently have an AUR package. Help welcome!

<!-- ## Docker -->

<!-- If you prefer you can run this software inside Docker: -->

<!-- ``` -->
<!-- docker run --rm -it -v \ -->
<!--     "$(pwd):/courses" \ -->
<!--     courseradl/courseradl -u <USER> -p <PASSWORD> -->
<!-- ``` -->

<!-- Or using netrc file: -->

<!-- ``` -->
<!-- docker run --rm -it \ -->
<!--     -v "$(pwd):/courses" -v "$HOME/.netrc:/netrc" \ -->
<!--     courseradl/courseradl -n /netrc -->
<!-- ``` -->

<!-- The actual working dir for coursera-dl is /courses, all courses will be -->
<!-- downloaded there if you don't specify otherwise. -->

## Create an account with Coursera

If you don't already have one, create a [Coursera][1] account and enroll in
a class. See https://www.coursera.org/courses for the list of classes.

# Authenticating

To authenticate with Coursera, you need a CAUTH cookie.

There are currently two supported ways to do so: you can have `cs-dlp` get it automatically from your browser, or you can pass one manually.

1. Automatic way
    1. Open your favorite browser and login into Coursera
    2. Call `cs-dlp` with `--cauth-auto browser` option.
 
        Valid options for `browser` are:
    
        * `chrome` for Google Chrome
        * `chromium`
        * `opera`
        * `opera_gx`
        * `brave`
        * `edge`
        * `vivaldi`
        * `firefox`
        * `librewolf`
        * `safari`
2. Manual way

    Pass a CAUTH cookie to the `--cauth` option.
    

# Running the script

Refer to `cs-dlp --help` for a complete, up-to-date reference on the runtime options
supported by this utility.

Run the script to download the materials by providing your Coursera CAUTH cookie,
the class names, as well as any additional parameters:

```
coursera-dl --cauth-auto chrome modelthinking-004
```

Here are some examples of how to invoke `cs-dlp` from the command line:
```
    Multiple classes:            cs-dlp --cauth-auto chrome saas historyofrock1-001 algo-2012-002
    Filter by section name:      cs-dlp --cauth-auto chrome -sf "Chapter_Four" crypto-004
    Filter by lecture name:      cs-dlp --cauth-auto chrome -lf "3.1_" ml-2012-002
    Download only ppt files:     cs-dlp --cauth-auto chrome -f "ppt" qcomp-2012-001
    Get the preview classes:     cs-dlp --cauth-auto chrome -b ni-001
	Download videos at 720p:     cs-dlp --cauth-auto chrome --video-resolution 720p ni-001
    Specify download path:       cs-dlp --cauth-auto chrome --path=C:\Coursera\Classes\ comnetworks-002
    Display help:                cs-dlp --help

    Maintain a list of classes in a dir:
      Initialize:              mkdir -p CURRENT/{class1,class2,..classN}
      Update:                  coursera-dl -n --path CURRENT `\ls CURRENT`
```
**Note:** If your `ls` command is aliased to display a colorized output, you
may experience problems.  Be sure to escape the `ls` command (use `\ls`) to
assure that no special characters get sent to the script.

Note that we *do* support the New Platform ("on-demand") courses.

By default, videos are downloaded at 540p resolution. For on-demand courses, the
`--video-resolution` flag accepts 360p, 540p, and 720p values.

To download just the `.txt` and/or `.srt` subtitle files instead of the videos,
use `--ignore-formats mp4 --subtitle-language en` or whatever format the videos
are encoded in and desired languages for subtitles.

If you want to store your preferred parameters,
create a file named `coursera-dl.conf`
where the script is supposed to be executed, with the following format:
```
    --subtitle-language en,zh-CN|zh-TW
    --download-quizzes
    #--mathjax-cdn https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js
    # more other parameters
```
Parameters which are specified in the file will be overriden if they are 
provided again on the commandline.

**Note:** In `coursera-dl.conf`, all the parameters should not be wrapped
with quotes.

## Resuming downloads

In default mode when you interrupt the download process by pressing
<kbd>CTRL</kbd>+<kbd>C</kbd>, partially downloaded files will be deleted from your disk and
you have to start the download process from the beginning. If your
download was interrupted by something other than KeyboardInterrupt
(<kbd>CTRL</kbd>+<kbd>C</kbd>) like sudden system crash, partially downloaded files will
remain on your disk and the next time you start the process again,
these files will be discarded from download list!, therefore it's your
job to delete them manually before next start. For this reason we
added an option called `--resume` which continues your downloads from
where they stopped:

	cs-dlp --cauth-auto chrome --resume sdn1-001

This option can also be used with external downloaders:

	cs-dlp --cauth-auto chrome --wget --resume sdn1-001

*Note 1*: Some external downloaders use their own built-in resume feature
which may not be compatible with others, so use them at your own risk.

*Note 2*: Remember that in resume mode, interrupted files **WON'T** be deleted from
your disk.

# Troubleshooting

If you have problems when downloading class materials, please try to see if
one of the following actions solve your problem:

* Make sure the class name you are using corresponds to the resource name
  used in the URL for that class:
    `https://www.coursera.org/learn/<CLASS_NAME>/home/welcome`

* Have you tried to clean the cached cookies/credentials with the
  `--clear-cache` option?

* Note that many courses (most, perhaps?) may remove the materials after a
  little while after the course is completed, while other courses may retain
  the materials up to a next session/offering of the same course (to avoid
  problems with academic dishonesty, apparently).
  <br><br>
  In short, it is not guaranteed that you will be able to download after the
  course is finished and this is, unfortunately, nothing that we can help
  you with.

* One can export a Netscape-style cookies file with a browser extension ([1][9], [2][10])
  and use it with the `-c` option. This comes in handy
  when the authentication via password is not working (the authentication
  process changes now and then).

<!-- * If results show 0 sections, you most likely have provided invalid -->
<!--   credentials (username and/or password in the command line or in your -->
<!--   `.netrc` file or in your `coursera-dl.conf` file). -->

* For courses that have not started yet, but have had a previous iteration
  sometimes a preview is available, containing all the classes from the last
  course. These files can be downloaded by passing the `--preview`
  parameter.

* If you get an error like `Could not find class: <CLASS_NAME>`, then:
    * Verify that the name of the course is correct. Current class
    names in coursera are composed by a short course name e.g. `class` and
    the current version of the course (a number). For example, for a
    class named `class`, you would have to use `class-001`, `class-002`
    etc.
    * Second, verify that you are enrolled in the course. You won't be
    able to access the course materials if you are not officially
    enrolled and agreed to the honor course *via the website*.

## China issues

If you are from China and you're having problems downloading videos,
adding "52.84.167.78 d3c33hcgiwev3.cloudfront.net" in the hosts file
(/etc/hosts) and freshing DNS with "ipconfig/flushdns" may work
(see https://github.com/googlehosts/hosts for more info).

## Found 0 sections and 0 lectures on this page

First of all, make sure you are enrolled to the course you want to download.

Many old courses have already closed enrollment so often it's not an
option. In this case, try downloading with `--preview` option. Some
courses allow to download lecture materials without enrolling, but
it's not common and is not guaranteed to work for every course.

Finally, you can download the videos if you have, at least, the index
file that lists all the course materials. Maybe your friend who is enrolled
could save that course page for you. In that case use the `--process_local_page`
option.

Alternatively you may want to try this various browser extensions designed for
this problem.

If none of the above works for you, there is nothing we can do.

## Download timeouts

cs-dlp supports external downloaders but note that they are only used to
download materials after the syllabus has been parsed, e.g. videos, PDFs, some
handouts and additional files (syllabus is always downloaded using the internal
downloader). If you experience problems with downloading such materials, you may
want to start using external downloader and configure its timeout values. For
example, you can use aria2c downloader by passing `--aria` option:

```
cs-dlp --cauth-auto chrome --path . --aria2  <course-name>
```

And put this into aria2c's configuration file `~/.aria2/aria2.conf` to reduce
timeouts:

```
connect-timeout=2
timeout=2
bt-stop-timeout=1
```

Timeout configuration for internal downloader is not supported.

## Windows: proxy support

If you're on Windows behind a proxy, set up the environment variables
before running the script as follows:

```
set HTTP_PROXY=http://host:port
set HTTPS_PROXY=http://host:port
```

Related discussion: [#205](https://github.com/coursera-dl/coursera-dl/issues/205)

<!-- ## SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure -->

<!-- This is a known error, please do not report about this error message! The problem is in **YOUR** environment. To fix it, do the following: -->

<!-- ``` bash -->
<!-- sudo apt-get install build-essential python-dev libssl-dev libffi-dev -->
<!-- pip install --user urllib3 pyasn1 ndg-httpsclient pyOpenSSL -->
<!-- ``` -->
<!-- If the error remains, try installing coursera-dl from github following this instruction: -->
<!-- https://github.com/coursera-dl/coursera-dl#alternative-installation-method-for-unix-systems -->

<!-- If you still have the problem, please read the following issues for more ideas on how to fix it: -->
<!-- [#330](https://github.com/coursera-dl/coursera-dl/issues/330) -->
<!-- [#377](https://github.com/coursera-dl/coursera-dl/issues/377) -->
<!-- [#329](https://github.com/coursera-dl/coursera-dl/issues/329) -->

<!-- This is also worth reading: -->
<!-- https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning -->

## Alternative CDN for `MathJax.js`

When saving a course page, we enabled `MathJax` rendering for math equations, by
injecting `MathJax.js` in the header. The script is using a cdn service provided
by [mathjax.org](https://cdn.mathjax.org/mathjax/latest/MathJax.js). However, that
url is not accessible in some countries/regions, you can provide a
`--mathjax-cdn <MATHJAX_CDN>` parameter to specify the `MathJax.js` file that is
accessible in your region.

# Reporting issues

Before reporting any issue please follow the steps below:

1. Verify that you are running the latest version of the script

2. If the problem persists, feel free to [open an issue](https://github.com/raffaem/cs-dlp/issues) in our
bugtracker, please fill the issue template with *as much information as
possible*.

# Donations

You can support the project by sponsoring me:

<iframe src="https://github.com/sponsors/raffaem/button" title="Sponsor raffaem" height="32" width="114" style="border: 0; border-radius: 6px;"></iframe>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cs-dlp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "Raffaele Mancuso <raffaelemancuso532@gmail.com>",
    "keywords": "MOOCs,coursera,coursera-dl,download,education,video",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/20/96/7630a59bcbe8c19eff77b319f5329e838eb7330f513401f1f8ffe50f1609/cs_dlp-0.12.0b0.tar.gz",
    "platform": null,
    "description": "# cs-dlp\n\nThis is a fork of [coursera-dl](https://github.com/coursera-dl/coursera-dl) that works with modern Python and modern coursera.org, with added features and patches.\n\n<!-- [![Build Status](https://travis-ci.org/coursera-dl/coursera-dl.svg?branch=master)](https://travis-ci.org/coursera-dl/coursera-dl) -->\n<!-- [![Build status](https://ci.appveyor.com/api/projects/status/3hru0ycv5fbny5k8/branch/master?svg=true)](https://ci.appveyor.com/project/balta2ar/coursera-dl/branch/master) -->\n<!-- [![Coverage Status](https://coveralls.io/repos/coursera-dl/coursera-dl/badge.svg)](https://coveralls.io/r/coursera-dl/coursera-dl) -->\n<!-- [![Latest version on PyPI](https://img.shields.io/pypi/v/coursera-dl.svg)](https://pypi.python.org/pypi/coursera-dl) -->\n<!-- [![Code Climate](https://codeclimate.com/github/coursera-dl/coursera-dl/badges/gpa.svg)](https://codeclimate.com/github/coursera-dl/coursera-dl) -->\n\n<!-- TOC -->\n\n- [Coursera Downloader](#coursera-downloader)\n- [Introduction](#introduction)\n- [Features](#features)\n- [Disclaimer](#disclaimer)\n- [Installation instructions](#installation-instructions)\n    - [Recommended installation method for all Operating Systems](#recommended-installation-method-for-all-operating-systems)\n    - [Alternative ways of installing missing dependencies](#alternative-ways-of-installing-missing-dependencies)\n        - [Alternative installation method for Unix systems](#alternative-installation-method-for-unix-systems)\n        - [ArchLinux](#archlinux)\n        - [Installing dependencies on your own](#installing-dependencies-on-your-own)\n    - [Docker](#docker)\n    - [Windows](#windows)\n    - [Create an account with Coursera](#create-an-account-with-coursera)\n- [Running the script](#running-the-script)\n    - [Resuming downloads](#resuming-downloads)\n- [Troubleshooting](#troubleshooting)\n    - [China issues](#china-issues)\n    - [Found 0 sections and 0 lectures on this page](#found-0-sections-and-0-lectures-on-this-page)\n    - [Download timeouts](#download-timeouts)\n    - [Windows: proxy support](#windows-proxy-support)\n    - [Windows: Failed to create process](#windows-failed-to-create-process)\n    - [SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure](#sslerror-errno-1-_sslc504-error14094410ssl-routinesssl3_read_bytessslv3-alert-handshake-failure)\n    - [Alternative CDN for `MathJax.js`](#alternative-cdn-for-mathjaxjs)\n- [Reporting issues](#reporting-issues)\n- [Filing an issue/Reporting a bug](#filing-an-issuereporting-a-bug)\n- [Feedback](#feedback)\n- [Contact](#contact)\n\n<!-- /TOC -->\n\n# Introduction\n\nThis script makes it easier to batch download lecture resources (e.g., videos, ppt,\netc) for [Coursera](coursera.org) classes.  Given one or more class names,\nit obtains week and class names from the *lectures* page, and then downloads\nthe related materials into appropriately named files and directories.\n\nThis work was originally inspired in part by [youtube-dl][3] by which\nI've downloaded many other good videos such as those from Khan Academy.\n\n\n# Features\n\n* Support for all kinds of courses (i.e., \"Old Platform\"/time-based as\n    well as \"New Platform\"/on-demand courses).\n* Intentionally detailed names, so that it will display and sort properly\n    on most interfaces (e.g., VLC or MX Video on Android devices).\n* Regex-based section (week) and lecture name filters to download only\n    certain resources.\n* File format extension filter to grab resource types you want.\n* Default arguments loaded from `coursera-dl.conf` file.\n* Core functionality tested on Linux, Mac and Windows.\n\n# Disclaimer\n\n`cs-dlp` is meant to be used only for your material that Coursera gives\nyou access to download.\n\nWe do not encourage any use that violates their [Terms Of Use](https://www.coursera.org/about/terms).\nA relevant excerpt:\n\n> \"[...] Coursera grants you a personal, non-exclusive, non-transferable\n> license to access and use the Sites. You may download material from the\n> Sites only for your own personal, non-commercial use. You may not\n> otherwise copy, reproduce, retransmit, distribute, publish, commercially\n> exploit or otherwise transfer any material, nor may you modify or create\n> derivatives works of the material.\"\n\n\n# Installation instructions\n\n`cs-dlp` requires Python 3 and a Coursera account enrolled in the class of interest.\n\n**Note:** `cs-dlp` is not compatible with Python 2.\n\nOn any operating system, ensure that the Python executable location is added\nto your `PATH` environment variable and, once you have the dependencies\ninstalled (see next section), for a *basic* usage, you will need to invoke\nthe script from the main directory of the project and prepend it with the\nword `python`.  You can also use more advanced features of the program by\nlooking at the \"Running the script\" section of this document.\n\n*Note:* You must already have (manually) agreed to the Honor of Code of the\nparticular courses that you want to use with `cs-dlp`.\n\n## Installing from source\n\nFrom a command line (preferably, from a virtual environment), simply issue\nthe command:\n\n    git clone https://github.com/raffaem/cs-dlp\n    cd cs-dlp\n    pip install --user .\n\n**Note 1:** We strongly recommend that you *don't* install the package\nglobally on your machine (i.e., with root/administrator privileges), as the\ninstalled modules may conflict with other Python applications that you have\ninstalled in your system. Prefer to use the option `--user` to `pip install`.\n\n### ArchLinux\n\n`cs-dlp` does not currently have an AUR package. Help welcome!\n\n<!-- ## Docker -->\n\n<!-- If you prefer you can run this software inside Docker: -->\n\n<!-- ``` -->\n<!-- docker run --rm -it -v \\ -->\n<!--     \"$(pwd):/courses\" \\ -->\n<!--     courseradl/courseradl -u <USER> -p <PASSWORD> -->\n<!-- ``` -->\n\n<!-- Or using netrc file: -->\n\n<!-- ``` -->\n<!-- docker run --rm -it \\ -->\n<!--     -v \"$(pwd):/courses\" -v \"$HOME/.netrc:/netrc\" \\ -->\n<!--     courseradl/courseradl -n /netrc -->\n<!-- ``` -->\n\n<!-- The actual working dir for coursera-dl is /courses, all courses will be -->\n<!-- downloaded there if you don't specify otherwise. -->\n\n## Create an account with Coursera\n\nIf you don't already have one, create a [Coursera][1] account and enroll in\na class. See https://www.coursera.org/courses for the list of classes.\n\n# Authenticating\n\nTo authenticate with Coursera, you need a CAUTH cookie.\n\nThere are currently two supported ways to do so: you can have `cs-dlp` get it automatically from your browser, or you can pass one manually.\n\n1. Automatic way\n    1. Open your favorite browser and login into Coursera\n    2. Call `cs-dlp` with `--cauth-auto browser` option.\n \n        Valid options for `browser` are:\n    \n        * `chrome` for Google Chrome\n        * `chromium`\n        * `opera`\n        * `opera_gx`\n        * `brave`\n        * `edge`\n        * `vivaldi`\n        * `firefox`\n        * `librewolf`\n        * `safari`\n2. Manual way\n\n    Pass a CAUTH cookie to the `--cauth` option.\n    \n\n# Running the script\n\nRefer to `cs-dlp --help` for a complete, up-to-date reference on the runtime options\nsupported by this utility.\n\nRun the script to download the materials by providing your Coursera CAUTH cookie,\nthe class names, as well as any additional parameters:\n\n```\ncoursera-dl --cauth-auto chrome modelthinking-004\n```\n\nHere are some examples of how to invoke `cs-dlp` from the command line:\n```\n    Multiple classes:            cs-dlp --cauth-auto chrome saas historyofrock1-001 algo-2012-002\n    Filter by section name:      cs-dlp --cauth-auto chrome -sf \"Chapter_Four\" crypto-004\n    Filter by lecture name:      cs-dlp --cauth-auto chrome -lf \"3.1_\" ml-2012-002\n    Download only ppt files:     cs-dlp --cauth-auto chrome -f \"ppt\" qcomp-2012-001\n    Get the preview classes:     cs-dlp --cauth-auto chrome -b ni-001\n\tDownload videos at 720p:     cs-dlp --cauth-auto chrome --video-resolution 720p ni-001\n    Specify download path:       cs-dlp --cauth-auto chrome --path=C:\\Coursera\\Classes\\ comnetworks-002\n    Display help:                cs-dlp --help\n\n    Maintain a list of classes in a dir:\n      Initialize:              mkdir -p CURRENT/{class1,class2,..classN}\n      Update:                  coursera-dl -n --path CURRENT `\\ls CURRENT`\n```\n**Note:** If your `ls` command is aliased to display a colorized output, you\nmay experience problems.  Be sure to escape the `ls` command (use `\\ls`) to\nassure that no special characters get sent to the script.\n\nNote that we *do* support the New Platform (\"on-demand\") courses.\n\nBy default, videos are downloaded at 540p resolution. For on-demand courses, the\n`--video-resolution` flag accepts 360p, 540p, and 720p values.\n\nTo download just the `.txt` and/or `.srt` subtitle files instead of the videos,\nuse `--ignore-formats mp4 --subtitle-language en` or whatever format the videos\nare encoded in and desired languages for subtitles.\n\nIf you want to store your preferred parameters,\ncreate a file named `coursera-dl.conf`\nwhere the script is supposed to be executed, with the following format:\n```\n    --subtitle-language en,zh-CN|zh-TW\n    --download-quizzes\n    #--mathjax-cdn https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js\n    # more other parameters\n```\nParameters which are specified in the file will be overriden if they are \nprovided again on the commandline.\n\n**Note:** In `coursera-dl.conf`, all the parameters should not be wrapped\nwith quotes.\n\n## Resuming downloads\n\nIn default mode when you interrupt the download process by pressing\n<kbd>CTRL</kbd>+<kbd>C</kbd>, partially downloaded files will be deleted from your disk and\nyou have to start the download process from the beginning. If your\ndownload was interrupted by something other than KeyboardInterrupt\n(<kbd>CTRL</kbd>+<kbd>C</kbd>) like sudden system crash, partially downloaded files will\nremain on your disk and the next time you start the process again,\nthese files will be discarded from download list!, therefore it's your\njob to delete them manually before next start. For this reason we\nadded an option called `--resume` which continues your downloads from\nwhere they stopped:\n\n\tcs-dlp --cauth-auto chrome --resume sdn1-001\n\nThis option can also be used with external downloaders:\n\n\tcs-dlp --cauth-auto chrome --wget --resume sdn1-001\n\n*Note 1*: Some external downloaders use their own built-in resume feature\nwhich may not be compatible with others, so use them at your own risk.\n\n*Note 2*: Remember that in resume mode, interrupted files **WON'T** be deleted from\nyour disk.\n\n# Troubleshooting\n\nIf you have problems when downloading class materials, please try to see if\none of the following actions solve your problem:\n\n* Make sure the class name you are using corresponds to the resource name\n  used in the URL for that class:\n    `https://www.coursera.org/learn/<CLASS_NAME>/home/welcome`\n\n* Have you tried to clean the cached cookies/credentials with the\n  `--clear-cache` option?\n\n* Note that many courses (most, perhaps?) may remove the materials after a\n  little while after the course is completed, while other courses may retain\n  the materials up to a next session/offering of the same course (to avoid\n  problems with academic dishonesty, apparently).\n  <br><br>\n  In short, it is not guaranteed that you will be able to download after the\n  course is finished and this is, unfortunately, nothing that we can help\n  you with.\n\n* One can export a Netscape-style cookies file with a browser extension ([1][9], [2][10])\n  and use it with the `-c` option. This comes in handy\n  when the authentication via password is not working (the authentication\n  process changes now and then).\n\n<!-- * If results show 0 sections, you most likely have provided invalid -->\n<!--   credentials (username and/or password in the command line or in your -->\n<!--   `.netrc` file or in your `coursera-dl.conf` file). -->\n\n* For courses that have not started yet, but have had a previous iteration\n  sometimes a preview is available, containing all the classes from the last\n  course. These files can be downloaded by passing the `--preview`\n  parameter.\n\n* If you get an error like `Could not find class: <CLASS_NAME>`, then:\n    * Verify that the name of the course is correct. Current class\n    names in coursera are composed by a short course name e.g. `class` and\n    the current version of the course (a number). For example, for a\n    class named `class`, you would have to use `class-001`, `class-002`\n    etc.\n    * Second, verify that you are enrolled in the course. You won't be\n    able to access the course materials if you are not officially\n    enrolled and agreed to the honor course *via the website*.\n\n## China issues\n\nIf you are from China and you're having problems downloading videos,\nadding \"52.84.167.78 d3c33hcgiwev3.cloudfront.net\" in the hosts file\n(/etc/hosts) and freshing DNS with \"ipconfig/flushdns\" may work\n(see https://github.com/googlehosts/hosts for more info).\n\n## Found 0 sections and 0 lectures on this page\n\nFirst of all, make sure you are enrolled to the course you want to download.\n\nMany old courses have already closed enrollment so often it's not an\noption. In this case, try downloading with `--preview` option. Some\ncourses allow to download lecture materials without enrolling, but\nit's not common and is not guaranteed to work for every course.\n\nFinally, you can download the videos if you have, at least, the index\nfile that lists all the course materials. Maybe your friend who is enrolled\ncould save that course page for you. In that case use the `--process_local_page`\noption.\n\nAlternatively you may want to try this various browser extensions designed for\nthis problem.\n\nIf none of the above works for you, there is nothing we can do.\n\n## Download timeouts\n\ncs-dlp supports external downloaders but note that they are only used to\ndownload materials after the syllabus has been parsed, e.g. videos, PDFs, some\nhandouts and additional files (syllabus is always downloaded using the internal\ndownloader). If you experience problems with downloading such materials, you may\nwant to start using external downloader and configure its timeout values. For\nexample, you can use aria2c downloader by passing `--aria` option:\n\n```\ncs-dlp --cauth-auto chrome --path . --aria2  <course-name>\n```\n\nAnd put this into aria2c's configuration file `~/.aria2/aria2.conf` to reduce\ntimeouts:\n\n```\nconnect-timeout=2\ntimeout=2\nbt-stop-timeout=1\n```\n\nTimeout configuration for internal downloader is not supported.\n\n## Windows: proxy support\n\nIf you're on Windows behind a proxy, set up the environment variables\nbefore running the script as follows:\n\n```\nset HTTP_PROXY=http://host:port\nset HTTPS_PROXY=http://host:port\n```\n\nRelated discussion: [#205](https://github.com/coursera-dl/coursera-dl/issues/205)\n\n<!-- ## SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure -->\n\n<!-- This is a known error, please do not report about this error message! The problem is in **YOUR** environment. To fix it, do the following: -->\n\n<!-- ``` bash -->\n<!-- sudo apt-get install build-essential python-dev libssl-dev libffi-dev -->\n<!-- pip install --user urllib3 pyasn1 ndg-httpsclient pyOpenSSL -->\n<!-- ``` -->\n<!-- If the error remains, try installing coursera-dl from github following this instruction: -->\n<!-- https://github.com/coursera-dl/coursera-dl#alternative-installation-method-for-unix-systems -->\n\n<!-- If you still have the problem, please read the following issues for more ideas on how to fix it: -->\n<!-- [#330](https://github.com/coursera-dl/coursera-dl/issues/330) -->\n<!-- [#377](https://github.com/coursera-dl/coursera-dl/issues/377) -->\n<!-- [#329](https://github.com/coursera-dl/coursera-dl/issues/329) -->\n\n<!-- This is also worth reading: -->\n<!-- https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning -->\n\n## Alternative CDN for `MathJax.js`\n\nWhen saving a course page, we enabled `MathJax` rendering for math equations, by\ninjecting `MathJax.js` in the header. The script is using a cdn service provided\nby [mathjax.org](https://cdn.mathjax.org/mathjax/latest/MathJax.js). However, that\nurl is not accessible in some countries/regions, you can provide a\n`--mathjax-cdn <MATHJAX_CDN>` parameter to specify the `MathJax.js` file that is\naccessible in your region.\n\n# Reporting issues\n\nBefore reporting any issue please follow the steps below:\n\n1. Verify that you are running the latest version of the script\n\n2. If the problem persists, feel free to [open an issue](https://github.com/raffaem/cs-dlp/issues) in our\nbugtracker, please fill the issue template with *as much information as\npossible*.\n\n# Donations\n\nYou can support the project by sponsoring me:\n\n<iframe src=\"https://github.com/sponsors/raffaem/button\" title=\"Sponsor raffaem\" height=\"32\" width=\"114\" style=\"border: 0; border-radius: 6px;\"></iframe>\n",
    "bugtrack_url": null,
    "license": "GNU LESSER GENERAL PUBLIC LICENSE\n                               Version 3, 29 June 2007\n        \n         Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n         Everyone is permitted to copy and distribute verbatim copies\n         of this license document, but changing it is not allowed.\n        \n        \n          This version of the GNU Lesser General Public License incorporates\n        the terms and conditions of version 3 of the GNU General Public\n        License, supplemented by the additional permissions listed below.\n        \n          0. Additional Definitions.\n        \n          As used herein, \"this License\" refers to version 3 of the GNU Lesser\n        General Public License, and the \"GNU GPL\" refers to version 3 of the GNU\n        General Public License.\n        \n          \"The Library\" refers to a covered work governed by this License,\n        other than an Application or a Combined Work as defined below.\n        \n          An \"Application\" is any work that makes use of an interface provided\n        by the Library, but which is not otherwise based on the Library.\n        Defining a subclass of a class defined by the Library is deemed a mode\n        of using an interface provided by the Library.\n        \n          A \"Combined Work\" is a work produced by combining or linking an\n        Application with the Library.  The particular version of the Library\n        with which the Combined Work was made is also called the \"Linked\n        Version\".\n        \n          The \"Minimal Corresponding Source\" for a Combined Work means the\n        Corresponding Source for the Combined Work, excluding any source code\n        for portions of the Combined Work that, considered in isolation, are\n        based on the Application, and not on the Linked Version.\n        \n          The \"Corresponding Application Code\" for a Combined Work means the\n        object code and/or source code for the Application, including any data\n        and utility programs needed for reproducing the Combined Work from the\n        Application, but excluding the System Libraries of the Combined Work.\n        \n          1. Exception to Section 3 of the GNU GPL.\n        \n          You may convey a covered work under sections 3 and 4 of this License\n        without being bound by section 3 of the GNU GPL.\n        \n          2. Conveying Modified Versions.\n        \n          If you modify a copy of the Library, and, in your modifications, a\n        facility refers to a function or data to be supplied by an Application\n        that uses the facility (other than as an argument passed when the\n        facility is invoked), then you may convey a copy of the modified\n        version:\n        \n           a) under this License, provided that you make a good faith effort to\n           ensure that, in the event an Application does not supply the\n           function or data, the facility still operates, and performs\n           whatever part of its purpose remains meaningful, or\n        \n           b) under the GNU GPL, with none of the additional permissions of\n           this License applicable to that copy.\n        \n          3. Object Code Incorporating Material from Library Header Files.\n        \n          The object code form of an Application may incorporate material from\n        a header file that is part of the Library.  You may convey such object\n        code under terms of your choice, provided that, if the incorporated\n        material is not limited to numerical parameters, data structure\n        layouts and accessors, or small macros, inline functions and templates\n        (ten or fewer lines in length), you do both of the following:\n        \n           a) Give prominent notice with each copy of the object code that the\n           Library is used in it and that the Library and its use are\n           covered by this License.\n        \n           b) Accompany the object code with a copy of the GNU GPL and this license\n           document.\n        \n          4. Combined Works.\n        \n          You may convey a Combined Work under terms of your choice that,\n        taken together, effectively do not restrict modification of the\n        portions of the Library contained in the Combined Work and reverse\n        engineering for debugging such modifications, if you also do each of\n        the following:\n        \n           a) Give prominent notice with each copy of the Combined Work that\n           the Library is used in it and that the Library and its use are\n           covered by this License.\n        \n           b) Accompany the Combined Work with a copy of the GNU GPL and this license\n           document.\n        \n           c) For a Combined Work that displays copyright notices during\n           execution, include the copyright notice for the Library among\n           these notices, as well as a reference directing the user to the\n           copies of the GNU GPL and this license document.\n        \n           d) Do one of the following:\n        \n               0) Convey the Minimal Corresponding Source under the terms of this\n               License, and the Corresponding Application Code in a form\n               suitable for, and under terms that permit, the user to\n               recombine or relink the Application with a modified version of\n               the Linked Version to produce a modified Combined Work, in the\n               manner specified by section 6 of the GNU GPL for conveying\n               Corresponding Source.\n        \n               1) Use a suitable shared library mechanism for linking with the\n               Library.  A suitable mechanism is one that (a) uses at run time\n               a copy of the Library already present on the user's computer\n               system, and (b) will operate properly with a modified version\n               of the Library that is interface-compatible with the Linked\n               Version.\n        \n           e) Provide Installation Information, but only if you would otherwise\n           be required to provide such information under section 6 of the\n           GNU GPL, and only to the extent that such information is\n           necessary to install and execute a modified version of the\n           Combined Work produced by recombining or relinking the\n           Application with a modified version of the Linked Version. (If\n           you use option 4d0, the Installation Information must accompany\n           the Minimal Corresponding Source and Corresponding Application\n           Code. If you use option 4d1, you must provide the Installation\n           Information in the manner specified by section 6 of the GNU GPL\n           for conveying Corresponding Source.)\n        \n          5. Combined Libraries.\n        \n          You may place library facilities that are a work based on the\n        Library side by side in a single library together with other library\n        facilities that are not Applications and are not covered by this\n        License, and convey such a combined library under terms of your\n        choice, if you do both of the following:\n        \n           a) Accompany the combined library with a copy of the same work based\n           on the Library, uncombined with any other library facilities,\n           conveyed under the terms of this License.\n        \n           b) Give prominent notice with the combined library that part of it\n           is a work based on the Library, and explaining where to find the\n           accompanying uncombined form of the same work.\n        \n          6. Revised Versions of the GNU Lesser General Public License.\n        \n          The Free Software Foundation may publish revised and/or new versions\n        of the GNU Lesser General Public License from time to time. Such new\n        versions will be similar in spirit to the present version, but may\n        differ in detail to address new problems or concerns.\n        \n          Each version is given a distinguishing version number. If the\n        Library as you received it specifies that a certain numbered version\n        of the GNU Lesser General Public License \"or any later version\"\n        applies to it, you have the option of following the terms and\n        conditions either of that published version or of any later version\n        published by the Free Software Foundation. If the Library as you\n        received it does not specify a version number of the GNU Lesser\n        General Public License, you may choose any version of the GNU Lesser\n        General Public License ever published by the Free Software Foundation.\n        \n          If the Library as you received it specifies that a proxy can decide\n        whether future versions of the GNU Lesser General Public License shall\n        apply, that proxy's public statement of acceptance of any version is\n        permanent authorization for you to choose that version for the\n        Library.",
    "summary": "Script for downloading Coursera.org videos and naming them.",
    "version": "0.12.0b0",
    "project_urls": {
        "Homepage": "https://github.com/raffaem/cs-dlp"
    },
    "split_keywords": [
        "moocs",
        "coursera",
        "coursera-dl",
        "download",
        "education",
        "video"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4d2bcda41f2fdf833d3fe5c1def31a967d2b7a8b0bfbcd59b05c9552b29b4aa9",
                "md5": "0bc6f0ef7c2f05f7e7e8e5aa8b0a962f",
                "sha256": "be4d5b974bef0f196ea58050de8913a22244127d9c71e4929707bf9e53a9dd73"
            },
            "downloads": -1,
            "filename": "cs_dlp-0.12.0b0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0bc6f0ef7c2f05f7e7e8e5aa8b0a962f",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 62969,
            "upload_time": "2023-06-15T22:56:17",
            "upload_time_iso_8601": "2023-06-15T22:56:17.708258Z",
            "url": "https://files.pythonhosted.org/packages/4d/2b/cda41f2fdf833d3fe5c1def31a967d2b7a8b0bfbcd59b05c9552b29b4aa9/cs_dlp-0.12.0b0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "20967630a59bcbe8c19eff77b319f5329e838eb7330f513401f1f8ffe50f1609",
                "md5": "ec9997cd9c53466ea2c7ecf5bf7aebfa",
                "sha256": "a4d6c8c5f1b860142c4e2227179c6ec33c31207e74b7c01a106a335aef5115ea"
            },
            "downloads": -1,
            "filename": "cs_dlp-0.12.0b0.tar.gz",
            "has_sig": false,
            "md5_digest": "ec9997cd9c53466ea2c7ecf5bf7aebfa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 214573,
            "upload_time": "2023-06-15T22:56:15",
            "upload_time_iso_8601": "2023-06-15T22:56:15.411425Z",
            "url": "https://files.pythonhosted.org/packages/20/96/7630a59bcbe8c19eff77b319f5329e838eb7330f513401f1f8ffe50f1609/cs_dlp-0.12.0b0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-15 22:56:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "raffaem",
    "github_project": "cs-dlp",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "appveyor": true,
    "tox": true,
    "lcname": "cs-dlp"
}
        
Elapsed time: 0.18770s