DEV Community

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

How to download courses from Linkedin Learning with python

Bruce on March 29, 2021

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 ...
Collapse
 
ronnyn78 profile image
ronnyn78

Thanks is working now perfect

Collapse
 
knowbee profile image
Bruce

Awesome

Collapse
 
ronnyn78 profile image
ronnyn78

sometimes it says This video is locked, you probably need a premium account

Thread Thread
 
knowbee profile image
Bruce

That happens when you don't have a premium account and you are trying to download a paid course

Thread Thread
 
ronnyn78 profile image
ronnyn78

am using library card to access

Thread Thread
 
knowbee profile image
Bruce

Linkedin has added a security layer where while using library card, they hide download links in their API.

Thread Thread
 
ronnyn78 profile image
ronnyn78

thanks for wonderfull tool i will pay for premium account and download everything i need to study

Thread Thread
 
knowbee profile image
Bruce

You are welcome. you can even use a free trial account :)

Thread Thread
 
ronnyn78 profile image
ronnyn78

thanks

Thread Thread
 
luisguilherme profile image
luis-guilherme

I have the same issue, I can access the full courses online on the browser (my linkedin account is linked to my corporate learning account). It downloads some videos but not all from the course.

Thread Thread
 
iitparakram profile image
Parakram IIT (ISM) Dhanbad

Any solution found @luisguilherme ?

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

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

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

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
 
rugadameghanath profile image
Meghanath Rugada • Edited

I did this , but did not see your comment before doing it. could have saved so much time atleast 40 mins :)

Collapse
 
ledigh profile image
Ledigh@dt

Good Morning!
Firstly, thanks for the program, your time, your efforts:
Very helpful tool :)

I’ve encountered issues concerning video quality resolutions. By default it’s 720p, but using, for example, this following link:
linkedin.com/learning/advanced-dru...
…the results are a mix of 540p and 720p, though all 540p still have their corresponding 720p versions available; I can even download them from the “Internet Download Manager” button through its browser extension.

I’ve also tried with another downloader… Same results!
Any ideas on how to fix it ?
Thanks ;)

Collapse
 
ronnyn78 profile image
ronnyn78

guys maybe am doing something wrong

C:\Users\user1\AppData\Local\Programs\Python\Python38-32\Scripts>llvd -c "cisco-C:\Users\user1\AppData\Local\Programs\Python\Python38-32\Scripts>llvd -c "cisco-certified-cyberops-associate-cert-prep-1" -r 720 --cookies

Using cookie info from cookies.txt
Your cookie is expired

Collapse
 
rugadameghanath profile image
Meghanath Rugada • Edited

It worked. i tried both password and cookie method. both worked. Mostly you are using an expired cookie or a wrong jsession id

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

Glad the tool was helpful

Collapse
 
j_casey_33753098466f57c21 profile image
J Casey

This was working fine for me, but all of the sudden when I put in the course it asks me for my email and I can enter that fine. Then it tells me to put in my password and I try to type it in but whenever I press any keys, nothing shows up on the screen and im unable to enter my password. Any thoughts? I've tried uninstalling and reinstalling and that didn't work.

Collapse
 
maestrogreg profile image
Gregory Anderson

Brilliant! Thanks.

Collapse
 
fabiyi_olaleye profile image
Fabiyi Olaleye

I appreciate your effort and thoughtfulness for building this amazing tool.

I did install the library tool and followed the instructions above to the best of my knowledge. However, I have something like this text below but I just can't input my password to proceed the download.

Enter your Linkedin Password:

Although, I could enter my LinkedIn email address. Mind you, I have a trial account on LinkedIn learning.
How do I proceed from here?

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
Bruce

Yes

Collapse
 
maskmelo profile image
baroko • Edited

Hi,
I followed all steps but stuck at $ llvd --help (not work) and don't know where to put cookies.txt on Mac Os Big Sur, I'm new with mac os.
On Windows, everything worked fined except slow speed than real internet speed.
And btw, is there any command that help download only subtitle or only exercise file, all file are decent fast but exercise is too slow.
Thanks, you helped me study a lots!

Collapse
 
knowbee profile image
Bruce

There is a a command for downloading subtitles, you just pass in the flag --subtitles

Collapse
 
jan_151 profile image
Jan

Your script is very helpful and it worked like a charm so far. Thank you! But recently something happened, perhaps on provider side, and I can’t download entire course anymore. The process interrupts, throwing the error, and tries to download again and enters to looping cycle as I understand. In result downloading ends with the errors and the contents is incomplete. What is the problem?

Error below:

...........
Current: 03-Diving into a Python Project/03-Getting what you need from lists with slices.mp4 @720p
Downloading video... : 100%|██████████████████████████████████████████████████████| 7.82M/7.82M [00:02<00:00, 2.67MB/s]
Downloading subtitles..

Current: 03-Diving into a Python Project/04-Looping and iteration.mp4 @720p
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\llvd\app.py", line 221, in download_entire_course
download_video(download_url, video_index, video_name, chapter_path, delay)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\llvd\downloader.py", line 31, in download_video
total=int(download_size),

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Collapse
 
legs965 profile image
legs965

Absolutely nice work!

Using Firefox on Windows so i needed an extension to get the values of li_at and JSESSIONID.
Created cookies.txt and placed it.
Started llvd with --cookies.
Folder is created. Download starts. Everything works - except the language is not correct. They are all downloaded in chinese (I suppose)
Experimentally I added two additional entries in cookies.txt:
lil-lang=de_DE
lang="v=2&lang=de-de"
which are the actual Cookies-values.

Still Chinese-language.

What am I missing?

Collapse
 
yaovicoder profile image
Yaovi Ametepe

Works like a charm

Collapse
 
nrthw profile image
nrthw

What's the correct path for the cookies.txt file on MacOSX (where should it be put)? I keep getting "cookies.txt is not found or empty" error. Thanks!

Collapse
 
lightray1 profile image
Luca S.

Awesome!

Collapse
 
anishkgt profile image
anishkgt

For some reason i get this error "That course is not found" regardless of which video i try to download. Earlier it worked but now it does not.

Collapse
 
rugadameghanath profile image
Meghanath Rugada

This helped a lot. Just that i had a bad installation of pythons , so took some time to sort them out for this to work in windows

Collapse
 
ronnyn78 profile image
ronnyn78

some pls help am geeting this error msg

Using cookie info from cookies.t
Your cookie is expired

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

You could try authenticating with cookies

Collapse
 
rahulmaurya profile image
Raynax9

Showing error after credentials

Collapse
 
mukhtaaraziz profile image
MukhtaarAziz

Hi!!! thank you man.

Collapse
 
tyger2000 profile image
tyger2000

Its not working with library card. In library card we don't have email address. We only have a 14 digit number.
Any help on this ?

Collapse
 
knowbee profile image
Bruce

With library card you can use cookie-based authentication...check the documentation

Collapse
 
tyger2000 profile image
tyger2000

Thanks, it worked !

Collapse
 
ronnyn78 profile image
ronnyn78

Bruce it is possible to show us some steps for doing this on a linux mchine (ubuntu or Linux mint)

Collapse
 
tijjken profile image
Wakeel Kehinde Ige

I got wrong credentials all the time even after changing my password several times😔

Collapse
 
sagarjain13 profile image
sagarjain13

thanks :)

Collapse
 
faisalahammad profile image
Faisal Ahammad

You're awesome bro 😎

Collapse
 
tush10 profile image
tush10

Enter your Linkedin Password:
Wrong credentials, try again

I am entering correct password

Collapse
 
itaiii profile image
Itaiii

Can anyone confirme that it's still working? (May 2022)

Collapse
 
floriangeorgiev profile image
FlorianGeorgiev • Edited

May I set a destination folder different than "Scripts". I don't see any flag that I can use. So, where is it hardcoded? I want to change it.

Collapse
 
davemega profile image
DaveMega

Hi guys... Is this method still working on Mac?

Collapse
 
kmohsenk profile image
kmohsenk

Thanks. it's so awesome