yt-dlp: [oreilly] KeyError('next') when trying to login to O'Reilly

Checklist

  • I’m reporting a bug unrelated to a specific site
  • I’ve verified that I’m running yt-dlp version 2022.04.08 (update instructions) or later (specify commit)
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I’ve read the guidelines for opening an issue

Description

Im getting an error while visiting some oreillys courses . “ERROR: 10000MNHV202259: An extractor error has occurred. (caused by KeyError(‘next’));” Does anyone know about this?

Verbose log

[debug] Encodings: locale cp1252, fs utf-8, out utf-8, err utf-8, pref cp1252
[debug] yt-dlp version 2022.04.08 [7884ade65]
[debug] Python version 3.10.2 (CPython 64bit) - Windows-10-10.0.19044-SP0
[debug] Checking exe version: ffmpeg -bsfs
[debug] Checking exe version: ffprobe -bsfs
[debug] exe versions: ffmpeg 2022-01-19-git-dd17c86aa1-full_build-www.gyan.dev (setts), ffprobe 2022-01-19-git-dd17c86aa1-full_build-www.gyan.dev
[debug] Optional libraries: brotli, certifi, Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2022.04.08, Current version: 2022.04.08
yt-dlp is up to date (2022.04.08)
[safari:course] Downloading login page
ERROR: 10000MNHV202259: An extractor error has occurred. (caused by KeyError('next')); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "C:\Users\d\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 639, in extract
    self.initialize()
  File "C:\Users\d\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\common.py", line 544, in initialize
    self._perform_login(username, password)
  File "C:\Users\d\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\extractor\safari.py", line 44, in _perform_login
    'https://api.oreilly.com', qs['next'][0])
KeyError: 'next'

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 20 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Hey Sorry for the trouble ! I changed the version using python -m pip install -U git+https://github.com/sulyi/yt-dlp.git@oreilly-login-fix I can confirm it is working fine. Thanks for the help

As a temporary fix I was able to copy headers from POST login call using browser console and copy headers in https://github.com/sulyi/yt-dlp/blob/oreilly-login-fix/yt_dlp/extractor/safari.py#L49 and it worked. Will see if can fix it systematically.

Initially cookies are set in two phases first when you provide email it checks few things and then another call for login with password.

I can code and willing to implement solution. I don’t know what needs to be done though.

I tried to use the fork sulyi:oreilly-login-fix

Try again, that’s not a log from 10a2af1 for sure. It still tries to login using https://api.oreilly.com instead of https://www.oreilly.com/member/auth/login/.

Currently I can’t verify if mentioned branch works with specific url since the trial account Lecharge kindly setup for me have already expired, but I was still able to download first minute of the videos.

Please ask help on discord if you need to troubleshoot how to apply patch.