DEV Community

loading...
Cover image for How to download courses from Linkedin Learning with python

How to download courses from Linkedin Learning with python

knowbee profile image Bruce ・Updated on ・2 min read

In this tutorial we will see how to download Linkedin learning courses with a simple cli tool. Just a quick setup and you will be able to download videos and courses.

Prerequisites

We will need Python3.

Now, what's next?

Open your terminal or command line and download a python package from PyPi called llvd which stands for Linkedin Learning Video Downloader

$ pip install llvd
Enter fullscreen mode Exit fullscreen mode

If you have multiple versions of python installed in your system, use pip3 instead.


    $ llvd --help

Enter fullscreen mode Exit fullscreen mode

If the above command does not fail, you can continue with the tutorial

To download a course:

  • Log in to the Linkedin Learning app.
  • Search for any course.
    sc2

  • Navigate to the course of your choice.

  • Copy its slug.

one

  • Open your terminal or command line.
  • Copy the command given below and replace course-slug with your copied course slug and run it

    $ llvd -c "course-slug" -r 720

Enter fullscreen mode Exit fullscreen mode

llvd creates separate folders for each course you download, groups all videos by chapters, and renames all downloaded videos with video names so that they will be ordered properly.

To download a course you have to specify its name (-c flag ).

How it looks like in action

Available features with this tool

  • Cookie-based authentication
  • Download a course and all its exercises
  • Group videos by chapters
  • Ability to download video subtitles(by specifying --caption flag)
  • Ability to resume failed downloads
  • Option to choose video format (360p, 540p, 720p) using -r flag

Cookie-based Authentication

  • Click on the options in google chrome (top right with 3 vertical dots).
  • After this, click on more tools followed by Developer Tools (you can also reach here by using the keyboard combination — ctrl+shift+I).

  • Now once you’ve gained access to the developer tools, navigate to the Application tab, and copy the value of two cookies from there named li_at and JSESSIONID respectively.

  • Create a cookies.txt file to a place you want to download your courses then paste in the values of li_at and JSESSIONID as shown below.

  li_at=xxxxx
  JSESSIONID="ajax:xxxxxx"
Enter fullscreen mode Exit fullscreen mode

      $ llvd -c "course-slug" -r 720 --cookies

Enter fullscreen mode Exit fullscreen mode

Download the course with subtitles

Use the --caption flag to download videos with subtitles


    $ llvd -c "course-slug" -r 720 --caption
Enter fullscreen mode Exit fullscreen mode

or


    $ llvd -c "course-slug" -r 720 -ca
Enter fullscreen mode Exit fullscreen mode

Wrapping up

If you liked this tutorial you might as well head over to Github and leave a star to this awesome open source project llvd

Thanks for reading 😊!

Discussion (17)

Collapse
shahidtweetz profile image
Shahid Hussain • Edited

C:\Users\User1>llvd -c what-is-php-for-wordpress -r 720
Please enter your Linkedin email address: mrshahid@outlook.com
Enter your Linkedin Password:
Traceback (most recent call last):
File "c:\python39\lib\site-packages\llvd\app.py", line 106, in download_entire_course
course_name = r.json()['elements'][0]['title']
KeyError: 'elements'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python39\Scripts\llvd-script.py", line 33, in
sys.exit(load_entry_point('llvd==2.2.5', 'console_scripts', 'llvd')())
File "c:\python39\lib\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "c:\python39\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\python39\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python39\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\python39\lib\site-packages\llvd_init.py", line 60, in main
llvd.run()
File "c:\python39\lib\site-packages\llvd\app.py", line 81, in run
self.download_entire_course()
File "c:\python39\lib\site-packages\llvd\app.py", line 179, in download_entire_course
os.remove(f'{self.chapter_path}/{self.current_video_index:0=2d}-{clean_name(self.current_video_name)}.mp4')
TypeError: unsupported format string passed to NoneType.
format_

C:\Users\User1>

Collapse
knowbee profile image
Bruce Author

You are getting this error because you are using the wrong slug for the course

Instead of using what-is-php-for-wordpress you should use php-for-wordpress.
It is advised to navigate to a course you are trying to download, then copy the slug from there instead of the course name

I am guessing this the course you were trying to download (linkedin.com/learning/php-for-word...
)

Collapse
knowbee profile image
Bruce Author

Make sure you also update to the latest version 2.2.6 with better error handling

Thanks for using the tool 😊

Collapse
minhducbg profile image
minhducbg • Edited

Working!!! On Windows.
For dummies like me

  1. Install Python 3
  2. Open CMD Type: cd "C:\Users\"Your_User_name" \AppData\Local\Programs\Python\Python39\Scripts" and hit Enter

Ex:
cd "C:\Users\Share Full Vn.DESKTOP-K6RVJFF\AppData\Local\Programs\Python\Python39\Scripts"

// My Python ver is 3.9

3 - Type "pip install llvd" in CMD and wait
4 - Create a txt file with the exact name "cookies.txt" as above instruction
5 - Put that txt file in the folder "Scripts" above
6 - Type your custom code and hit Enter to download
EX:
If I want download this course: engineering-drawings-for-manufacturing

My code:
llvd -c "engineering-drawings-for-manufacturing" -r 720 --cookies

-c: name of the of the course with slug
-r 720: Videp 720p
-ca: Download the course with subtitles
--cookies: use cookies in "cookies.txt" to allow authentication to get the video download link of the course

The course will save in folder "Scripts" above

Collapse
mayurkadam24 profile image
mayurkadam24

I Tried Following the above steps by it asks me my LinkedIn Learning Creds and my account is not a premium one. However, i have a Student Library card with which i'm logged in but don't have the Email account for that, How can i download in that case ?

Collapse
knowbee profile image
Bruce Author

You could login with your library card in the browser then grab the cookies and use that with llvd..

Follow these instructions github.com/knowbee/llvd#cookie-bas...

Collapse
l4zehr profile image
l4zehr

I tried it and it worked. I don't have a premium linkedin account. I was able to download the 24 hours free course I'm learning. Thank youuu!!!

Collapse
mukhtaaraziz profile image
MukhtaarAziz • Edited

You can use a library card (eCard).

Collapse
l4zehr profile image
l4zehr

What is that?

Collapse
knowbee profile image
Bruce Author

Glad the tool was helpful

Collapse
oyeyemi profile image
oyeyemi

Thanks so much.
Would i be able to download multiple parallel courses at the same time by opening multiple CMD.

Collapse
knowbee profile image
Collapse
mukhtaaraziz profile image
MukhtaarAziz

Hi!!! thank you man.

Collapse
juliana_barillaro profile image
Juliana Barillaro

hey there! I'm getting an environment error when trying to install pip3 install llvd

does anyone know what it can be? I'm new :(

Collapse
juliana_barillaro profile image
Juliana Barillaro

sorry, no, I fixed it, but now my terminal says it fails to connect when I input my linkedin credentials. is it a network error?

Collapse
knowbee profile image
Bruce Author

You could try authenticating with cookies

Collapse
rahulmaurya profile image
Raynax9

Showing error after credentials

Forem Open with the Forem app