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

[linkedin:learning] can't download second section #20326

Open
5 of 9 tasks
mbryde opened this issue Mar 12, 2019 · 46 comments
Open
5 of 9 tasks

[linkedin:learning] can't download second section #20326

mbryde opened this issue Mar 12, 2019 · 46 comments

Comments

@mbryde
Copy link

mbryde commented Mar 12, 2019

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.09. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2019.03.09

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

youtube-dl --proxy REDACTED@gmail.REDACTED@REDACTED.com:80 \
--username REDACTED@gmail.com --password REDACTED \
-f 'bestvideo[height<=720]+bestaudio/best[height<=720]' \
-o '%(playlist_title)s/Lesson %(chapter_number)02d - %(chapter)s/%(playlist_index)s - %(title)s.%(ext)s' --restrict-filenames --verbose --add-metadata --write-sub --limit-rate 2M --min-sleep-interval 5 --max-sleep-interval 10 \
"https://www.linkedin.com/learning/photoshop-cc-2018-essential-training-the-basics"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--proxy', u'REDACTED@gmail.com:REDACTED@REDACTED.com:80', u'--username', u'PRIVATE', u'--password', u'PRIVATE', u'-f', u'bestvideo[height<=720]+bestaudio/best[height<=720]', u'-o', u'%(playlist_title)s/Lesson %(chapter_number)02d - %(chapter)s/%(playlist_index)s - %(title)s.%(ext)s', u'--restrict-filenames', u'--verbose', u'--add-metadata', u'--write-sub', u'--limit-rate', u'2M', u'--min-sleep-interval', u'5', u'--max-sleep-interval', u'10', u'https://www.linkedin.com/learning/photoshop-cc-2018-essential-training-the-basics']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2019.03.09
[debug] Python version 2.7.15rc1 (CPython) - Linux-4.15.0-46-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.4, ffprobe 3.4.4
[debug] Proxy map: {u'http': u'REDACTED@gmail.com:REDACTED@REDACTED.com:80', u'https': u'REDACTED@gmail.com:REDACTED@REDACTED.com:80'}
[linkedin:learning:course] Downloading login page
[linkedin:learning:course] Logging in
[linkedin:learning:course] Downloading JSON metadata
[download] Downloading playlist: Photoshop CC 2018 Essential Training: The Basics
[linkedin:learning:course] playlist Photoshop CC 2018 Essential Training: The Basics: Collected 63 video ids (downloading 63 of them)
[download] Downloading video 1 of 63
[linkedin:learning] Downloading login page
[linkedin:learning] Logging in
[linkedin:learning] welcome: Downloading 360p JSON metadata
[linkedin:learning] welcome: Downloading 540p JSON metadata
[linkedin:learning] welcome: Downloading 720p JSON metadata
[linkedin:learning] welcome: Downloading m3u8 information
[debug] Invoking downloader on u'https://files3.lynda.com/secure/courses/625922/VBR_MP4h264_main_HD720/625922_00_01_WX30_welPSE.mp4?bZylE9zHX0NXuLt37pG5nguuMkfIbHyoUxOhh_NxW9t6Jcia74AuY3g8RvnSuNSTU9chCakoiJDJy1WIXJTnQ9ykPGWvquamgnYYZowPynjIMJL3z0bZijOTAP_GrQN9Hmtwg4-2D2Ybd6HyvoZTWUSD3MAWyCz1IOObmmPdmmubGNRCS0sI1g'
[download] Sleeping 7.10 seconds...
[download] Destination: Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/01 - Welcome.mp4
[download] 100% of 7.45MiB in 00:03
[ffmpeg] Adding metadata to 'Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/01 - Welcome.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/01 - Welcome.mp4' -c copy -metadata 'date=20171005' -metadata 'purl=https://www.linkedin.com/learning/photoshop-cc-2018-essential-training-the-basics/welcome' -metadata 'title=Welcome' 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/01 - Welcome.temp.mp4'
[download] Downloading video 2 of 63
[linkedin:learning] what-you-should-know: Downloading 360p JSON metadata
[linkedin:learning] what-you-should-know: Downloading 540p JSON metadata
[linkedin:learning] what-you-should-know: Downloading 720p JSON metadata
[linkedin:learning] what-you-should-know: Downloading m3u8 information
[debug] Invoking downloader on u'https://files3.lynda.com/secure/courses/625922/VBR_MP4h264_main_HD720/625922_00_02_XR30_whatKnow.mp4?a3tBiueHfR3hvgwkhccZuVyQ_2sulkhNy1CdbY5MjCeQsMZPLF0BoHJsd7Zr1K0uxIRDV2JrYHaAIsDL9S6km_xwTWbsIT0iYqFpk1FJ3QFxEOKYcVWLqYtEz_fH6RtrWKQDhdKehNNsRSupcDy6_5EWgMP8Tst1ctaR9sGNXfII-Ub7ZPsazryX'
[download] Sleeping 6.67 seconds...
[download] Destination: Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/02 - What_you_should_know.mp4
[download] 100% of 661.78KiB in 00:00
[ffmpeg] Adding metadata to 'Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/02 - What_you_should_know.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/02 - What_you_should_know.mp4' -c copy -metadata 'date=20171005' -metadata 'purl=https://www.linkedin.com/learning/photoshop-cc-2018-essential-training-the-basics/what-you-should-know' -metadata 'title=What you should know' 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/02 - What_you_should_know.temp.mp4'
[download] Downloading video 3 of 63
[linkedin:learning] using-the-exercise-files: Downloading 360p JSON metadata
[linkedin:learning] using-the-exercise-files: Downloading 540p JSON metadata
[linkedin:learning] using-the-exercise-files: Downloading 720p JSON metadata
[linkedin:learning] using-the-exercise-files: Downloading m3u8 information
[debug] Invoking downloader on u'https://files3.lynda.com/secure/courses/625922/VBR_MP4h264_main_HD720/625922_00_03_XR15_exFiles_519289.mp4?Y8vBhw2GaHpZH0vNNy029jVen0P54ARnb9jrCfBuF4h81i6bDDhWBnw3C8r2DbhErJwnT3phpJ2tZklkePg72Gdk9dSeG3Pgo-ZwujwgU6qi7uAX05-7QoxieTafN9lZTXve_1lfRPip_oCG3OlCXbfd8UOmPK1x0yW6RR-bm_neTDoWOB8DcGJNYGbK_g8y'
[download] Sleeping 7.69 seconds...
[download] Destination: Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/03 - Using_the_exercise_files.mp4
[download] 100% of 558.49KiB in 00:00
[ffmpeg] Adding metadata to 'Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/03 - Using_the_exercise_files.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/03 - Using_the_exercise_files.mp4' -c copy -metadata 'date=20171005' -metadata 'purl=https://www.linkedin.com/learning/photoshop-cc-2018-essential-training-the-basics/using-the-exercise-files' -metadata 'title=Using the exercise files' 'file:Photoshop_CC_2018_Essential_Training_-_The_Basics/Lesson 01 - Introduction/03 - Using_the_exercise_files.temp.mp4'
[download] Downloading video 4 of 63
[linkedin:learning] opening-documents-in-photoshop: Downloading 360p JSON metadata
[linkedin:learning] opening-documents-in-photoshop: Downloading 540p JSON metadata
[linkedin:learning] opening-documents-in-photoshop: Downloading 720p JSON metadata
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 522, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/linkedin.py", line 126, in _real_extract
    self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr'))
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 1319, in _sort_formats
    raise ExtractorError('No video formats found')
ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.


Description of your issue, suggested solution and other information

The formatting of the playlist_title is changed. The same with the title it didn't always give you underscores in the filenames, just spaces. (Photoshop_CC_2018_Essential_Training_-_The_Basics) But the main issue is that it seems to download the first "section" of the videos just fine. But as soon as the new section begins it spits out this error.

@mbryde mbryde changed the title [linkedin:learning [linkedin:learning] can't download second section Mar 12, 2019
@mbryde
Copy link
Author

mbryde commented Mar 13, 2019

I have an account on linkedin:learning. So it's not because I'm trying to grab them "for free" it has worked fine in the past.

EDITED: But I can confirm what you are saying even tho you supply a login and the script says it's logging in. It will only grab the free videos and not the paid ones.

@remitamine
Copy link
Collaborator

an account is needed to check the issue and make a fix for the problem if it's caused by youtube-dl.

@mbryde
Copy link
Author

mbryde commented Mar 13, 2019

@remitamine I have send you a email.

@mbryde
Copy link
Author

mbryde commented Mar 14, 2019

I can't even login now.....

[linkedin:learning] Logging in
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 472, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 462, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2006, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 805, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1004, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 871, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 794, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 521, in extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 425, in initialize
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/linkedin.py", line 65, in _real_initialize
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 786, in _download_webpage
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 652, in _download_webpage_handle
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 619, in _request_webpage
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2225, in urlopen
  File "/usr/lib/python2.7/urllib2.py", line 421, in open
    protocol = req.get_type()
  File "/usr/lib/python2.7/urllib2.py", line 283, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: /checkpoint/lg/login-submit

@MatthewJohnSymons
Copy link

I'm also getting the same unknown url type: /checkpoint/lg/login-submit when manually providing the authentication credentials and I'm getting the following output when using cookies:

$ youtube-dl --cookies=cookies.txt https://www.linkedin.com/learning/solidworks-advanced-sketching --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--cookies=cookies.txt', 'https://www.linkedin.com/learning/solidworks-advanced-sketching', '--verbose']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2019.03.09
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17763
[debug] exe versions: none
[debug] Proxy map: {}
ERROR: An extractor error has occurred. (caused by KeyError('JSESSIONID',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\common.py", line 522, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\linkedin.py", line 157, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\linkedin.py", line 34, in _call_api
KeyError: 'JSESSIONID'
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\common.py", line 522, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\linkedin.py", line 157, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\linkedin.py", line 34, in _call_api
KeyError: 'JSESSIONID'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\YoutubeDL.py", line 794, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\extractor\common.py", line 535, in extract
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('JSESSIONID',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@guguja
Copy link

guguja commented Mar 14, 2019

It looks like the extractor needs to call the /checkpoint/enterprise/login URL

@mbryde
Copy link
Author

mbryde commented Mar 15, 2019

I get this when using cookie.txt extension:

# HTTP Cookie File by Genuinous @genuinous.
# No cookies for linkedin.com.
# Download all cookies.

@mbryde
Copy link
Author

mbryde commented Mar 18, 2019

Even with the new release of youtube-dl I still can't login. How do I get the cookies exported @adiov ?

@bdrtsky
Copy link

bdrtsky commented Mar 19, 2019

@adiov thanks for instruction. I tried like you wrote and have this

Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 2006, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 522, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/linkedin.py", line 95, in _real_extract
    course_slug, 'selectedVideo', video_slug, height)['selectedVideo']
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/linkedin.py", line 34, in _call_api
    'Csrf-Token': self._get_cookies(api_url)['JSESSIONID'].value,
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 2778, in _get_cookies
    return compat_cookies.SimpleCookie(req.get_header('Cookie'))
  File "/usr/lib/python2.7/Cookie.py", line 583, in __init__
    if input: self.load(input)
  File "/usr/lib/python2.7/Cookie.py", line 643, in load
    for k, v in rawdata.items():
AttributeError: 'unicode' object has no attribute 'items'

@bdrtsky
Copy link

bdrtsky commented Mar 19, 2019

I am also have this when I try to login without cookies

ValueError: unknown url type: /checkpoint/lg/login-submit

@bdrtsky
Copy link

bdrtsky commented Mar 20, 2019

Guys. I am sorry for bothering again. But we are talking here about biggest e-learning website on the Planet. Can we please fix it?

@bdrtsky
Copy link

bdrtsky commented Mar 20, 2019

@adiov like I wrote, I did yoyr instructions with cookie! I got this error

Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 2006, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 522, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/linkedin.py", line 95, in _real_extract
    course_slug, 'selectedVideo', video_slug, height)['selectedVideo']
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/linkedin.py", line 34, in _call_api
    'Csrf-Token': self._get_cookies(api_url)['JSESSIONID'].value,
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 2778, in _get_cookies
    return compat_cookies.SimpleCookie(req.get_header('Cookie'))
  File "/usr/lib/python2.7/Cookie.py", line 583, in __init__
    if input: self.load(input)
  File "/usr/lib/python2.7/Cookie.py", line 643, in load
    for k, v in rawdata.items():
AttributeError: 'unicode' object has no attribute 'items'

@bdrtsky
Copy link

bdrtsky commented Mar 20, 2019

I made it with mentioned session.txt extention

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

............

@bdrtsky
Copy link

bdrtsky commented Mar 20, 2019

Could it because I tried to update youtube-dl with pip?

@bdrtsky
Copy link

bdrtsky commented Mar 20, 2019

I tried to replace as you told, it didn't help.

I am using Ubuntu 16.04, extention that you reccomend

Screenshot from 2019-03-21 00-53-23

I am not sure what else could be wrong.

@bdrtsky
Copy link

bdrtsky commented Mar 21, 2019

OMG, this cookie.txt format is complete brain dead. Who made this? I still can't make this work

AttributeError: 'unicode' object has no attribute 'items'

@eliadjoke
Copy link

eliadjoke commented Mar 24, 2019

having the same issue here, i run the command youtube-dl -v --cookies cookies.txt "https://www.linkedin.com/learning/solidworks-advanced-sketching/belt-chain"

and get the output

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--cookies', u'cookies.txt', u'https://www.linkedin.com/learning/solidworks-advanced-sketching/belt-chain']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.03.18
[debug] Python version 2.7.15 (CPython) - Darwin-18.2.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1
[debug] Proxy map: {}
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2006, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 529, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/linkedin.py", line 95, in _real_extract
    course_slug, 'selectedVideo', video_slug, height)['selectedVideo']
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/linkedin.py", line 34, in _call_api
    'Csrf-Token': self._get_cookies(api_url)['JSESSIONID'].value,
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 2816, in _get_cookies
    return compat_cookies.SimpleCookie(req.get_header('Cookie'))
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 583, in __init__
    if input: self.load(input)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 643, in load
    for k, v in rawdata.items():
AttributeError: 'unicode' object has no attribute 'items'

when i use user name and password cmmand
youtube-dl --username "mail@gmail.com" --password "pass" --verbose --sleep-interval 120 "https://www.linkedin.com/learning/solidworks-advanced-sketching/belt-chain"

i get the below output

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--username', u'PRIVATE', u'--password', u'PRIVATE', u'--verbose', u'--sleep-interval', u'120', u'https://www.linkedin.com/learning/python-essential-training-2']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.03.18
[debug] Python version 2.7.15 (CPython) - Darwin-18.2.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1
[debug] Proxy map: {}
[linkedin:learning:course] Downloading login page
[linkedin:learning:course] Logging in
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 472, in main
    _real_main(argv)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/__init__.py", line 462, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2006, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 528, in extract
    self.initialize()
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 432, in initialize
    self._real_initialize()
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/linkedin.py", line 65, in _real_initialize
    data=urlencode_postdata(data))
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 793, in _download_webpage
    expected_status=expected_status)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 659, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 626, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 2225, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 421, in open
    protocol = req.get_type()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 283, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: /checkpoint/lg/login-submit

@bdrtsky
Copy link

bdrtsky commented Mar 24, 2019

Exactly. Both methods doesn't work - email:pass & cookie

@eliadjoke
Copy link

eliadjoke commented Mar 24, 2019

@adiov thanks for the reply
using EditThisCookie extension in google chrome my cookies.txt file look like the below

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by EditThisCookie
.linkedin.com	TRUE	/	FALSE	1893133400	__ssid	4a1aVdfe-0c9f-4527-a598-0(8ea3c89684f
.linkedin.com	TRUE	/	FALSE	1616514621	_ga	GA1.2.788730575.1553367758
.linkedin.com	TRUE	/	FALSE	1553443221	_gat	1
.linkedin.com	TRUE	/	TRUE	4564535353	_guid	0ae2606c-4710-47294-8b17-8ffda0920d37
.linkedin.com	TRUE	/	FALSE	1555959993	_lipt	CwEAAAFpq_KJGVdTUbRTpBCsYHTDvRso-sieOTjoczHpgL21ZQPqzrslnwmBFlYlTHmrd_ZDs4j_fJgd9HFw2uAisuob3vQlcVQnZenEmappOkcRHZPUCeaNqGG3YjtYb4wWvSC9xzrYb1B0PAap16HxB_4tvjLvfZwDMy7GCZ3v86WXVTC3viJGxzG7wQvNxtjdeUw
.linkedin.com	TRUE	/	FALSE	4564535353	aam_uuid	40343431852501421712992027833138320141
.linkedin.com	TRUE	/	FALSE	1616597832	AMCV_14215E3D5B95C57C0A495C55%40AdobeOrg	-1303530583%7CMCIDTS%7C17979%7CMCMID%7C39777900609525975202975470099839344838%7CMCAAMLH-1554044232%7C6%7CMCAAMB-1554044232%7CRKhpRz8krg2tLO6pCuXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1553446632s%7CNONE%7CvVersion%7C3.3.0%7CMCCIDH%7C1669403847
.linkedin.com	TRUE	/	FALSE	0	AMCVS_14215E3D5995C57C0A46*C55%40AdobeOrg	1
.linkedin.com	TRUE	/	FALSE	1610006332	bcookie	"v=2&7cbea$510-9482-4109-85ce-f6193dcbd7dc"
.linkedin.com	TRUE	/	FALSE	0	lang	v=2&lang=en-us
.linkedin.com	TRUE	/	TRUE	1555959998	li_oatml	AQFTjDUuDKm_wAAAWmr8pDnVTWxvIN9IvTDrCS1XWu8uBZqYgWyTbpZT1Ct9bHZCjZuet21cHe7X6xksOwWBm3WVOgGMQNMs
.linkedin.com	TRUE	/	FALSE	1563315495	liap	true
.linkedin.com	TRUE	/	FALSE	1552454998	lidc	"b=VB52:g=19(6:u=16:i=1553442651:t=1553454998:s=AQGOXdwx3DucRPeRgZVbsaNqru8T6ZDR"
.linkedin.com	TRUE	/	FALSE	1562633462	UserMatchHistory	AQLMOCNgCIQwpxgAAAWmwZU1XgLWa6OwknBKAnL1gkn6FHfH4C0ZVBD9szs9MOgT3fkFb4CHpZNuFs77fspNE7W_xyPMTWyFtKfl1FWcmMmAuSNfhjtT7I_vZibqoOwsKcBcxINHXm5LcsQM-i3FwDlP2bhOanVYpvddBzoEjL6FMOViawmrM2VVbwgNiMDfAKcG77tGmICyIIrJJZVAPMrMasqx88GnhGb
.linkedin.com	TRUE	/	FALSE	1584974580	utag_main	v_id:0169abf543bc001a75c2880939f903078002207000c48$_sn:3$_se:16$_ss:0$_st:1553441480062$vapi_domain:linkedin.com$ses_id:1553439349096%3Bexp-session$_pn:4%3Bexp-session
.www.linkedin.com	TRUE	/	TRUE	1610006332	bscookie	"v=1&201901072CC2119adb409bd-7c85-391-82e9-3e1f82209c38AQFVbuUDkPFjOoNJRNU_uduCG5z1Z0Na"
.www.linkedin.com	TRUE	/	TRUE	1561215495	JSESSIONID	"ajax:26800093889696185263"
.www.linkedin.com	TRUE	/	TRUE	1584975495	li_at	AQEDLYhPAE5rXVAAABabA1mU0AAAFp1EIdTU0ApljPUZnh3LbyVeJveR3hgUWynp2B7T6ZPG6lINpCsXsaQIn5MydCePdcoOPXH2Mk3b4G6N7KzCDf6E6mV_CQ_U7XR_7Z_onW-rQ9U4cgbDb_Va
.www.linkedin.com	TRUE	/	FALSE	1561215495	sl	v=1&D7teB
www.linkedin.com	FALSE	/	FALSE	0	lil-lang	en_US
www.linkedin.com	FALSE	/	FALSE	1616511405	visit	"v=1&M"

after i run the command youtube-dl -v --cookies cookies.txt "https://www.linkedin.com/learning/solidworks-advanced-sketching/belt-chain"

my cookies.txt file changes to look like the below

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

.linkedin.com	TRUE	/	FALSE	0	AMCVS_14215E3D5995C57C0A495C55%40AdobeOrg	1
.linkedin.com	TRUE	/	FALSE	1893133400	__ssid	4a1aVdfe-0c9f-4527-a598-0(8ea3c89684f
.linkedin.com	TRUE	/	FALSE	1616514621	_ga	GA1.2.788730575.1553367758
.linkedin.com	TRUE	/	FALSE	1553443221	_gat	1
.linkedin.com	TRUE	/	TRUE	4564535353	_guid	0ae2606c-4710-47294-8b17-8ffda0920d37
.linkedin.com	TRUE	/	FALSE	1555959993	_lipt	CwEAAAFpq_KJGVdTUbRTpBCsYHTDvRso-sieOTjoczHpgL21ZQPqzrslnwmBFlYlTHmrd_ZDs4j_fJgd9HFw2uAisuob3vQlcVQnZenEmappOkcRHZPUCeaNqGG3YjtYb4wWvSC9xzrYb1B0PAap16HxB_4tvjLvfZwDMy7GCZ3v86WXVTC3viJGxzG7wQvNxtjdeUw
.linkedin.com	TRUE	/	FALSE	4564535353	aam_uuid	40343431852501421712992027833138320141
.linkedin.com	TRUE	/	FALSE	1616597832	AMCV_14215E3D5B95C57C0A495C55%40AdobeOrg	-1303530583%7CMCIDTS%7C17979%7CMCMID%7C39777900609525975202975470099839344838%7CMCAAMLH-1554044232%7C6%7CMCAAMB-1554044232%7CRKhpRz8krg2tLO6pCuXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1553446632s%7CNONE%7CvVersion%7C3.3.0%7CMCCIDH%7C1669403847
.linkedin.com	TRUE	/	FALSE	0	AMCVS_14215E3D5995C57C0A46*C55%40AdobeOrg	1
.linkedin.com	TRUE	/	FALSE	1610006332	bcookie	"v=2&7cbea$510-9482-4109-85ce-f6193dcbd7dc"
.linkedin.com	TRUE	/	FALSE	0	lang	v=2&lang=en-us
.linkedin.com	TRUE	/	TRUE	1555959998	li_oatml	AQFTjDUuDKm_wAAAWmr8pDnVTWxvIN9IvTDrCS1XWu8uBZqYgWyTbpZT1Ct9bHZCjZuet21cHe7X6xksOwWBm3WVOgGMQNMs
.linkedin.com	TRUE	/	FALSE	1563315495	liap	true
.linkedin.com	TRUE	/	FALSE	1552454998	lidc	"b=VB52:g=19(6:u=16:i=1553442651:t=1553454998:s=AQGOXdwx3DucRPeRgZVbsaNqru8T6ZDR"
.linkedin.com	TRUE	/	FALSE	1562633462	UserMatchHistory	AQLMOCNgCIQwpxgAAAWmwZU1XgLWa6OwknBKAnL1gkn6FHfH4C0ZVBD9szs9MOgT3fkFb4CHpZNuFs77fspNE7W_xyPMTWyFtKfl1FWcmMmAuSNfhjtT7I_vZibqoOwsKcBcxINHXm5LcsQM-i3FwDlP2bhOanVYpvddBzoEjL6FMOViawmrM2VVbwgNiMDfAKcG77tGmICyIIrJJZVAPMrMasqx88GnhGb
.linkedin.com	TRUE	/	FALSE	1584974580	utag_main	v_id:0169abf543bc001a75c2880939f903078002207000c48$_sn:3$_se:16$_ss:0$_st:1553441480062$vapi_domain:linkedin.com$ses_id:1553439349096%3Bexp-session$_pn:4%3Bexp-session
.www.linkedin.com	TRUE	/	TRUE	1610006332	bscookie	"v=1&201901072CC2119adb409bd-7c85-391-82e9-3e1f82209c38AQFVbuUDkPFjOoNJRNU_uduCG5z1Z0Na"
.www.linkedin.com	TRUE	/	TRUE	1561215495	JSESSIONID	"ajax:26800093889696185263"
.www.linkedin.com	TRUE	/	TRUE	1584975495	li_at	AQEDLYhPAE5rXVAAABabA1mU0AAAFp1EIdTU0ApljPUZnh3LbyVeJveR3hgUWynp2B7T6ZPG6lINpCsXsaQIn5MydCePdcoOPXH2Mk3b4G6N7KzCDf6E6mV_CQ_U7XR_7Z_onW-rQ9U4cgbDb_Va
.www.linkedin.com	TRUE	/	FALSE	1561215495	sl	v=1&D7teB
www.linkedin.com	FALSE	/	FALSE	0	lil-lang	en_US
www.linkedin.com	FALSE	/	FALSE	1616511405	visit	"v=1&M"

@bdrtsky
Copy link

bdrtsky commented Mar 25, 2019

@adiov is there's a tools to auto-format cookie file to this Netscape thing, by any chance? I can't google anything. I also noticed that after I try to run it with youtube-dl it's automaticaly replaces it's content!

@tmedicci
Copy link

same issue here, both using cookies and username/pass.

@tmedicci
Copy link

Guys, I was able to download using cookies after I uninstalled youtube-dl through pip and installed using pip3. In my machine, pip relates to python 2.7 and 'unicode' object has no attribute 'items' appears to be related with it.

@eliadjoke
Copy link

@tmedicci @adiov thanks guys 😁, followed @tmedicci steps and is working for me now, @bdrtsky you should try it and also use EditThisCookie extensions to save cookie.

@bdrtsky
Copy link

bdrtsky commented Mar 28, 2019

Yeah, I can't do that sudo pip uninstall youtube-dl ImportError: cannot import name main

Python is such a pain.

@mbryde
Copy link
Author

mbryde commented Apr 4, 2019

I uninstalled youtube-dl using pip and installed it again using pip3 - and using cookies I could download something. But only the free sections of videos. And I do indeed have premium to watch entire courses. Don't know what to do at this point....

[linkedin:learning] Downloading login page
[linkedin:learning] Logging in
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/__init__.py", line 474, in main
    _real_main(argv)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/__init__.py", line 464, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/YoutubeDL.py", line 2006, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 528, in extract
    self.initialize()
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 432, in initialize
    self._real_initialize()
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/linkedin.py", line 65, in _real_initialize
    data=urlencode_postdata(data))
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 793, in _download_webpage
    expected_status=expected_status)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 659, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 624, in _request_webpage
    url_or_request = sanitized_Request(url_or_request, data, headers)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/utils.py", line 561, in sanitized_Request
    return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
  File "/usr/lib/python3.6/urllib/request.py", line 329, in __init__
    self.full_url = url
  File "/usr/lib/python3.6/urllib/request.py", line 355, in full_url
    self._parse()
  File "/usr/lib/python3.6/urllib/request.py", line 384, in _parse
    raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: '/checkpoint/lg/login-submit'

Still get this long error when trying to use username and password (I don't have 2FA on my account)

Get this error when a paid video shows up:

[ffmpeg] Adding metadata to 'Easy PHP Projects - Single-Serving Sites/Lesson 02 - 1. What is My IP Address/04 - Find an IP address with PHP.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Easy PHP Projects - Single-Serving Sites/Lesson 02 - 1. What is My IP Address/04 - Find an IP address with PHP.mp4' -c copy -metadata 'title=Find an IP address with PHP' -metadata date=20151201 -metadata purl=https://www.linkedin.com/learning/easy-php-projects-single-serving-sites/find-an-ip-address-with-php 'file:Easy PHP Projects - Single-Serving Sites/Lesson 02 - 1. What is My IP Address/04 - Find an IP address with PHP.temp.mp4'
[download] Downloading video 5 of 30
[linkedin:learning] understanding-proxy-servers: Downloading 360p JSON metadata
[linkedin:learning] understanding-proxy-servers: Downloading 540p JSON metadata
[linkedin:learning] understanding-proxy-servers: Downloading 720p JSON metadata
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 529, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/linkedin.py", line 126, in _real_extract
    self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr'))
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 1326, in _sort_formats
    raise ExtractorError('No video formats found')
youtube_dl.utils.ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@zioalex
Copy link

zioalex commented Apr 30, 2019

Hi guys, I just updated to version 2019.04.30 and I got the same problem:

> ~/.local/bin/youtube-dl --cookies=cookies.txt --write-sub  -v  --sleep-interval 60  -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" https://www.linkedin.com/learning/learning-kubernetes/ 
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--cookies=cookies.txt', '--write-sub', '-v', '--sleep-interval', '60', '-o', '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s', 'https://www.linkedin.com/learning/learning-kubernetes/']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.04.30
[debug] Python version 3.6.8 (CPython) - Linux-4.20.0-sabayon-x86_64-Intel-R-_Core-TM-_i7-6600U_CPU_@_2.60GHz-with-gentoo-2.6
[debug] exe versions: ffmpeg 3.4.5, ffprobe 3.4.5, rtmpdump 2.4
[debug] Proxy map: {}
[linkedin:learning:course] Downloading JSON metadata
[download] Downloading playlist: Learning Kubernetes
...
...
...
[download] Learning Kubernetes/04 - What is containerization.mp4 has already been downloaded
[download] 100% of 12.73MiB
[download] Downloading video 5 of 33
[linkedin:learning] what-is-kubernetes: Downloading 360p JSON metadata
[linkedin:learning] what-is-kubernetes: Downloading 540p JSON metadata
[linkedin:learning] what-is-kubernetes: Downloading 720p JSON metadata
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/home/user/.local/lib64/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "/home/user/.local/lib64/python3.6/site-packages/youtube_dl/extractor/common.py", line 529, in extract
    ie_result = self._real_extract(url)
  File "/home/user/.local/lib64/python3.6/site-packages/youtube_dl/extractor/linkedin.py", line 127, in _real_extract
    self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr'))
  File "/home/user/.local/lib64/python3.6/site-packages/youtube_dl/extractor/common.py", line 1326, in _sort_formats
    raise ExtractorError('No video formats found')
youtube_dl.utils.ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Any update here?

@tony-izzo
Copy link

@eliadjoke Could you please also share the content of your cookies.txt? The 'unicode' object has no attribute 'items' error strongly points to your cookies.txt being malformed. Please be sure to replace the tokens and IDs in your cookies by similar strings to avoid compromising the security of your account.

...
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 796, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 530, in extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/discovery.py", line 75, in _real_extract
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 2819, in _get_cookies
  File "/usr/lib/python2.7/Cookie.py", line 583, in __init__
    if input: self.load(input)
  File "/usr/lib/python2.7/Cookie.py", line 643, in load
    for k, v in rawdata.items():
AttributeError: 'unicode' object has no attribute 'items'

Digging into the stack trace a little I see that the "unicode object..." error is coming from Cookies.py's load() function:

    def load(self, rawdata):
        """Load cookies from a string (presumably HTTP_COOKIE) or
        from a dictionary.  Loading cookies from a dictionary 'd'
        is equivalent to calling:
            map(Cookie.__setitem__, d.keys(), d.values())
        """
        if type(rawdata) == type(""):
            self.__ParseString(rawdata)
        else:
            # self.update() wouldn't call our custom __setitem__
            for k, v in rawdata.items():
                self[k] = v
        return
    # end load()

It expects to be passed either a str (type("")) or another SimpleCookie object. It checks for the first and assumes the second. So when it gets something that isn't str (unicode I presume) from File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 2819, in _get_cookies it tries to treat it like a SimpleCookie and invokes items() on it. Since it's not a SimpleCookie it throws.

Technically not youtube-dl's bug, but should be easy enough to code around. Note that the above snippet is from Python 2.7.12 as installed on my Linux machine so not exactly current.

@edgardmello
Copy link

Do what @tmedicci said. It worked for me. I'm using Mac OS

@adamnock
Copy link

adamnock commented Aug 7, 2019

Windows version 2019.08.02 no dice using cookies extracted using various tools in Netscape format.
Gets past free videos and errors out with no videos found.

Will install Py3 and try it as per @tmedicci's results under Linux

@balrawat
Copy link

Happens for me also

[linkedin:learning] ansible-overview: Downloading 360p JSON metadata [linkedin:learning] ansible-overview: Downloading 540p JSON metadata [linkedin:learning] ansible-overview: Downloading 720p JSON metadata ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info ie_result = ie.extract(url) File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 530, in extract ie_result = self._real_extract(url) File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/linkedin.py", line 127, in _real_extract self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr')) File "/usr/local/lib/python3.7/site-packages/youtube_dl/extractor/common.py", line 1327, in _sort_formats raise ExtractorError('No video formats found') youtube_dl.utils.ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
I'm on macos ( 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 )
youtube-dl version 2019.08.02

@RCcola1987
Copy link

Still not working with Linkedin Learning paid videos.
YTDL Version 2019.08.13

Verbose Output

D:\temp 2>youtube-dl --verbose --cookies cookies.txt https://www.linkedin.com/learning/writing-a-research-paper > error.txt
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '--cookies', 'cookies.txt', 'https://www.linkedin.com/learning/writing-a-research-paper']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2019.08.13
[debug] Python version 3.4.4 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-89073-gff8f40a630, ffprobe N-89073-gff8f40a630, phantomjs 2.1.1
[debug] Proxy map: {}
ERROR: An extractor error has occurred. (caused by KeyError('JSESSIONID',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest
version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72_\build\youtube_dl\extractor\common.py", line 530, in extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72_\build\youtube_dl\extractor\linkedin.py", line 158, in real_extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72
\build\youtube_dl\extractor\linkedin.py", line 36, in call_api
KeyError: 'JSESSIONID'
Traceback (most recent call last):
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72
\build\youtube_dl\extractor\common.py", line 530, in extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72_\build\youtube_dl\extractor\linkedin.py", line 158, in real_extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72
\build\youtube_dl\extractor\linkedin.py", line 36, in _call_api
KeyError: 'JSESSIONID'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72_\build\youtube_dl\YoutubeDL.py", line 796, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp5b8vs72_\build\youtube_dl\extractor\common.py", line 543, in extract
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('JSESSIONID',)); please report this issue on https://yt-dl.org/bug . Make sure
you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Also

D:\temp 2>youtube-dl -wi --cookies cookies.txt https://www.linkedin.com/learning/writing-a-research-paper
[linkedin:learning:course] Downloading JSON metadata
ERROR: Unable to download JSON metadata: HTTP Error 400: INKApi Error (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are
using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@sekmo
Copy link

sekmo commented Aug 22, 2019

For me changing the authentication from --cookies to -u (without -p) it worked

@hexerus
Copy link

hexerus commented Aug 27, 2019

As sekmo said above, it works with just the username and password on my side. Haven't tried cookies with LinkedIn learning yet (last time I checked they worked fine with lynda). Currently using the GUI program: youtube-dlg with youtube-dl version 2019.08.13 and here's what the command looks like:

youtube-dl.exe --newline -u joe.bob@gmail.com -p mypassword -i -o "C:\Users\Joe\Desktop\OutputFolder\%(playlist_index)s-%(title)s.%(ext)s" --verbose "https://www.linkedin.com/learning/learning-python-2"

@scgreenhalgh
Copy link

Just was forcibly migrated from Lynda.com to LinkedIn learning. Seems now I am having the same issue mentioned above. I have linked together my university account and my personal LinkedIn and can browse and watch all the libraries without issue!

I tried downloading: https://www.linkedin.com/learning/fusion-360-essential-training-2/

First video downloads without issue, second video I get the same error as above. I have tried both cookies and regular login. Using 2019.09.12.1 with Python3 on OSX.

ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/linkedin.py", line 127, in _real_extract
    self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr'))
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/common.py", line 1327, in _sort_formats
    raise ExtractorError('No video formats found')
youtube_dl.utils.ExtractorError: No video formats found; please report this issue on https

@scgreenhalgh
Copy link

can confirm and recreate the error @zioalex had with the same error using the same video/course. Downloads up to video 4 and error on video 5. Happens using both login creds and cookies.txt

[download] Downloading video 5 of 33
[linkedin:learning] what-is-kubernetes: Downloading 360p JSON metadata
[linkedin:learning] what-is-kubernetes: Downloading 540p JSON metadata
[linkedin:learning] what-is-kubernetes: Downloading 720p JSON metadata
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/linkedin.py", line 127, in _real_extract
    self._sort_formats(formats, ('width', 'height', 'source_preference', 'tbr', 'abr'))
  File "/Users/redacted/Dev/Python_virtualenvs/youtube-dl/lib/python3.6/site-packages/youtube_dl/extractor/common.py", line 1327, in _sort_formats
    raise ExtractorError('No video formats found')
youtube_dl.utils.ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@hexerus
Copy link

hexerus commented Sep 27, 2019

@scgreenhalgh That's weird. It is downloading all of 'em on my side on 2019.09.12.1. Both courses.

Here's what the command looks like:
youtube-dl.exe --newline -u myemail@gmail.com -p mypassword -i -o "C:\Users\JohnDoe\Desktop\llearning_dl\%(playlist_index)s-%(title)s.%(ext)s" --ignore-config --hls-prefer-native --external-downloader aria2c.exe "https://www.linkedin.com/learning/fusion-360-essential-training-2"

and for the other, replace the last parameter with "https://www.linkedin.com/learning/learning-kubernetes"

image

@scgreenhalgh
Copy link

scgreenhalgh commented Sep 28, 2019

Hmm, interesting @hexerus tried the same thing (apart from the external downloader flag) and still getting the same issues!

Out of curiosity are you on a paid account or one through a partnering organisation (i.e. a uni or library)?

edit: Tried again using the aria2c download library and still no dice!

youtube-dl --cookies cookies.txt --ignore-config --hls-prefer-native --external-downloader /usr/local/aria2/bin/aria2c --write-sub --verbose -o "downloads/%(playlist)s/%(playlist_title)s-%(playlist_index)s-%(title)s.%(ext)s" "https://www.linkedin.com/learning/fusion-360-essential-training-2"

@hexerus
Copy link

hexerus commented Sep 28, 2019

@scgreenhalgh Well, yes, I think at this point the only logical culprit would be account type. I have a yearly premium LinkedIn account that I migrated from Lynda.com. Do you have access to Lynda? If yes, try downloading from there. I remember using a university account there and it downloaded all courses that I needed, flawlessly, using the cookies.txt.

@scgreenhalgh
Copy link

@hexerus yeah it does seem to point to the account type being the issue which is kind of interesting seeing that it should be pulling from the same pages! Unfortunately they forcefully migrated me over and i can no longer access lynda.com.

@ssi-anik
Copy link

ssi-anik commented Dec 8, 2019

Just curious about those people who are not even afraid of sharing their cookies! 😲

@lyon667
Copy link

lyon667 commented Jan 18, 2020

Hi, I'm having the same issue as @scgreenhalgh described: my LI Learning access is not from a premium account but rather an "enterprise" one provided by a 3rd party which in my case is my employer. This basically lets me access the LinkedIn Learning via a single sign-on from outside LinkedIn itself (universities, companies, libraries, etc..) which is likely the cause of trouble.

I've been investigating the difference between what youtube-dl does now and how a browser behaves with the "enterprise" type of access and I've noticed it is all about just one missing extra header which can be seen through the browser's network inspector: x-li-identity

It looks like this is some kind of base64 encoded string containing extra entreprise account information in a format:
urn:li:enterpriseProfile:(urn:li:enterpriseAccount:<acc_number>,<unknown_number>)
there are two numbers first of which seems to be an user ID while the other one's meaning is so far unknown to me.

Anyway, to use this with youtube-dl it is possible to simply specify the header with --add-header flag and use the base64-encoded string retrieved from browser:
youtube-dl --add-header x-li-identity:<base64-goes-here> --cookies cookies.txt https://www.linkedin.com/learning/aws-for-architects-network-and-storage-design

So far I was not able to figure out where this string actually comes from so if someone has more luck it would be great start for fixing this problem within the code.

@martin54
Copy link
Contributor

martin54 commented Feb 15, 2020

lyon667 already described above the main part, how to get this working again … . In case it’s not clear yet, I wrote a more detailed step by step instruction:

My problems were:

  • Could only download free public videos (e.g. only the 1st from a course, and got “ERROR: No video formats found” for the others).
  • Unable to use cookies (error “AttributeError: 'unicode' object has no attribute 'items'”)
  • After fixing the --cookies error, still got the error “No video formats found”
  • FYI: I’m using an enterprise learning account (which is connected to my private linkedin account)

My workaround looks like this

C:\youtube-dl>python -m youtube_dl --cookies "cookies.txt" --add-header "x-li-identity:dX...Sk=" https://www.linkedin.com/learning/python-essential-training-2/hello-world

[linkedin:learning] hello-world: Downloading 360p JSON metadata
[linkedin:learning] hello-world: Downloading 540p JSON metadata
[linkedin:learning] hello-world: Downloading 720p JSON metadata
[linkedin:learning] hello-world: Downloading m3u8 information
[download] Destination: Hello world-687478.mp4
[download] 100% of 4.57MiB in 00:00

The essential part is: --cookies "cookies.txt" --add-header "x-li-identity:dX...Sk="
FYI:

  • No need for username/password on the command line.
  • The file cookies.txt + header value must be retrieved as described below.
  • I'm using the source code of youtube-dl, therefore python -m youtube_dl

Solution for --cookies error “AttributeError: 'unicode' object has no attribute 'items'”

  • Simply update from Python2 to Python3.
  • Probably alternative solution for Python2: Edit source file “youtube_dl/extractor/common.py” as described here.

How to get a valid cookies.txt file

  • Install Firefox with this Plugin
  • Use Firefox to login to linkedin:learning
  • Play a learning video e.g. on this page.
  • Use the plugin to export the file cookies.txt

How to get the "x-li-identity” header value

  • In Firefox press Ctrl-Shift-E to open the Network Monitor (development console).
  • Reload the linkedin:learning page with the video.
  • In the Network Monitor, search for “/learning-api/detailedCourses”, and click on one of the lines with the HTTP requests.
  • On the right side, scroll down to the request header line “x-li-identity: ...”, and copy the value to your command line option: --add-header "x-li-identity:..."

@martin54
Copy link
Contributor

@lyon667

So far I was not able to figure out where this string actually comes from so if someone has more luck it would be great start for fixing this problem within the code.

I found two sources for the "x-li-identity" value:

@dinosaw
Copy link

dinosaw commented May 21, 2020

Hi @martin54

I just wanted to thank you for your detailed explanation. Your problem was the same as mine, and your solution worked for me as well.

To add, I am also using SSO (single sign-on) and have my personal LinkedIn account linked to my LinkedIn Learning account that uses SSO.

When explicitly using the cookies and the x-li-identity header, I was able to grab the entire playlist of video files.

Thank you again!

@rushi3691
Copy link

Retry after adding a new cookies.txt file. It worked in my case.

@bahaaza
Copy link

bahaaza commented Aug 16, 2021

lyon667 already described above the main part, how to get this working again … . In case it’s not clear yet, I wrote a more detailed step by step instruction:

My problems were:

  • Could only download free public videos (e.g. only the 1st from a course, and got “ERROR: No video formats found” for the others).
  • Unable to use cookies (error “AttributeError: 'unicode' object has no attribute 'items'”)
  • After fixing the --cookies error, still got the error “No video formats found”
  • FYI: I’m using an enterprise learning account (which is connected to my private linkedin account)

My workaround looks like this

C:\youtube-dl>python -m youtube_dl --cookies "cookies.txt" --add-header "x-li-identity:dX...Sk=" https://www.linkedin.com/learning/python-essential-training-2/hello-world

[linkedin:learning] hello-world: Downloading 360p JSON metadata
[linkedin:learning] hello-world: Downloading 540p JSON metadata
[linkedin:learning] hello-world: Downloading 720p JSON metadata
[linkedin:learning] hello-world: Downloading m3u8 information
[download] Destination: Hello world-687478.mp4
[download] 100% of 4.57MiB in 00:00

The essential part is: --cookies "cookies.txt" --add-header "x-li-identity:dX...Sk="
FYI:

  • No need for username/password on the command line.
  • The file cookies.txt + header value must be retrieved as described below.
  • I'm using the source code of youtube-dl, therefore python -m youtube_dl

Solution for --cookies error “AttributeError: 'unicode' object has no attribute 'items'”

  • Simply update from Python2 to Python3.
  • Probably alternative solution for Python2: Edit source file “youtube_dl/extractor/common.py” as described here.

How to get a valid cookies.txt file

  • Install Firefox with this Plugin
  • Use Firefox to login to linkedin:learning
  • Play a learning video e.g. on this page.
  • Use the plugin to export the file cookies.txt

How to get the "x-li-identity” header value

  • In Firefox press Ctrl-Shift-E to open the Network Monitor (development console).
  • Reload the linkedin:learning page with the video.
  • In the Network Monitor, search for “/learning-api/detailedCourses”, and click on one of the lines with the HTTP requests.
  • On the right side, scroll down to the request header line “x-li-identity: ...”, and copy the value to your command line option: --add-header "x-li-identity:..."

This simple javascript code works for extracting the x-li-identity for me, paste it into the the course page with developer tools console:
console.log(document.getElementsByTagName('code')[0].innerHTML.match(/"enterpriseProfileHash":"(dX.*?)"/i)[1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests