Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Commit

Permalink
Added shields.io, added proper error message for #63, updated readme …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
r0oth3x49 committed Dec 30, 2017
1 parent 20c9084 commit 80e7827
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![GitHub release](https://img.shields.io/badge/release-v0.3-brightgreen.svg?style=flat-square)](https://github.com/r0oth3x49/udemy-dl/tree/e85feca476755944758149a8fc81ae8a02f15c2c)
[![GitHub stars](https://img.shields.io/github/stars/r0oth3x49/udemy-dl.svg?style=flat-square)](https://github.com/r0oth3x49/udemy-dl/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/r0oth3x49/udemy-dl.svg?style=flat-square)](https://github.com/r0oth3x49/udemy-dl/network)
[![GitHub issues](https://img.shields.io/github/issues/r0oth3x49/udemy-dl.svg?style=flat-square)](https://github.com/r0oth3x49/udemy-dl/issues)

# udemy-dl
**A cross-platform python based utility to download courses from udemy for personal offline use.**

Expand Down Expand Up @@ -65,55 +70,55 @@ You can download the latest version of udemy-dl by cloning the GitHub repository

***Downloading course***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL

***Downloading Course with specific resolution***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -r 720
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -r 720

***Downloading course to a specific location***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -o "/path/to/directory/"
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -o "/path/to/directory/"

***Downloading course with specific resolution to a specific location***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -r 720 -o "/path/to/directory/"
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -r 720 -o "/path/to/directory/"

***Saving download links***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -s
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -s

***Saving specific resolution download links***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -s -r 720
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -s -r 720

***Saving download links to specific location***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -s -o "/path/to/directory/"
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -s -o "/path/to/directory/"

***Saving specific resolution download links to specific location***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -s -r 720 -o "/path/to/directory/"
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -s -r 720 -o "/path/to/directory/"

***Downloading course and caching credentials***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME --configs
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL --configs

***Downloading with specific resolution and allow default resolution as well***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -r 1080 -d
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -r 1080 -d

***Downloading course but skip captions/subtitles***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME --skip-sub
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL --skip-sub

***Downloading captions/subtitles only***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME --sub-only
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL --sub-only

***Listing course's video informtion***

python udemy-dl.py -u [email protected] -p p4ssw0rd https://www.udemy.com/COURSE_NAME -l
python udemy-dl.py -u [email protected] -p p4ssw0rd COURSE_URL -l
the above command will list down the size of video and attached files and available resolutions for a video in a course.

### Advanced Usage
Expand Down Expand Up @@ -149,7 +154,7 @@ Options:
--skip-sub Download course but skip captions/subtitle.

Example:
python udemy-dl.py https://www.udemy.com/course_name/
python udemy-dl.py COURSE_URL
</code></pre>


Expand Down
10 changes: 6 additions & 4 deletions udemy/_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,10 @@ def login(self, username, password):
sys.exit(0)


def logout(self):
def logout(self, flag=True):
sys.stdout.write('\n')
sys.stdout.write(fc + sd + "[" + fm + sb + "*" + fc + sd + "] : " + fg + sd + "Downloaded course information webpages successfully..\n")
if flag:
sys.stdout.write(fc + sd + "[" + fm + sb + "*" + fc + sd + "] : " + fg + sd + "Downloaded course information webpages successfully..\n")
sys.stdout.write(fc + sd + "[" + fm + sb + "*" + fc + sd + "] : " + fg + sb + "Trying to logout now...\n")
try:
session.get(logout_url)
Expand Down Expand Up @@ -223,8 +224,9 @@ def real_extract(self, url, course_name, course_path):
response = session.get(_course_url).json()
_isenrolled = response.get('detail')
if _isenrolled:
sys.stdout.write(fc + sd + "[" + fr + sb + "-" + fc + sd + "] : " + fr + sb + "You are not enrolled in this course Udemy Says : {}.".format(_isenrolled))
self.logout()
sys.stdout.write(fc + sd + "[" + fr + sb + "-" + fc + sd + "] : " + fr + sb + "Udemy Says : {} either you are not enrolled in course or server didn't respond with course information webpages.\n".format(_isenrolled))
sys.stdout.write(fc + sd + "[" + fm + sb + "*" + fc + sd + "] : " + fw + sb + "Re-run udemy-dl against full course url (e.g :- https://www.udemy.com/course/learn/v4/overview)")
self.logout(flag=False)
exit(0)
num_lect = int(self._lecture_count(response))
sys.stdout.write(fc + sd + "[" + fm + sb + "*" + fc + sd + "] : " + fg + sd + "Found (%s) lectures ...\n" % (num_lect))
Expand Down

0 comments on commit 80e7827

Please sign in to comment.