yt-dlp: Linux/macOS/BSD chromium cookies could not be decrypted; failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
- I understand that I will be blocked if I intentionally remove or skip any mandatory* field
Checklist
- I’m reporting a bug unrelated to a specific site
- I’ve verified that I’m running yt-dlp version 2023.03.04 (update instructions) or later (specify commit)
- I’ve checked that all provided URLs are playable in a browser with the same IP and same login details
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched known issues and the bugtracker for similar issues including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
Provide a description that is worded well enough to be understood
Trying to download a video from panopto doesn’t seem to work as it doesnt seem to decrypt the cookies. Very similar to https://github.com/yt-dlp/yt-dlp/issues/1073 which seems to be resolved However I have the the most updated version but still seems to be not working.
I am running this on linux mint
Provide verbose output that clearly demonstrates the problem
- Run your yt-dlp command with -vU flag added (
yt-dlp -vU <your command line>) - If using API, add
'verbose': TruetoYoutubeDLparams instead - Copy the WHOLE output (starting with
[debug] Command-line config) and insert it below
Complete Verbose Output
yt-dlp -vU --cookies-from-browser chromium https://huji.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=64d725f2-972e-42f7-9eeb-afbf0067727a[debug] Command-line config: ['-vU', '--cookies-from-browser', 'chromium', 'https://huji.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=64d725f2-972e-42f7-9eeb-afbf0067727a']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d]
[debug] Lazy loading extractors is disabled
[debug] Python 3.8.10 (CPython x86_64 64bit) - Linux-5.15.0-60-generic-x86_64-with-glibc2.29 (OpenSSL 1.1.1f 31 Mar 2020, glibc 2.31)
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2019.11.28, mutagen-1.46.0, pyxattr-0.6.1, secretstorage-3.3.3, sqlite3-2.6.0, websockets-10.4
[Cookies] Extracting cookies from chromium
[debug] Extracting cookies from: "/home/ratio/.config/chromium/Default/Cookies"
[Cookies] Loading cookie 0/ 317[debug] detected desktop environment: CINNAMON
[debug] Chosen keyring: GNOMEKEYRING
WARNING: failed to decrypt cookie (AES-CBC) because UTF-8 decoding failed. Possibly the key is wrong?
[Cookies] Extracted 245 cookies from chromium (72 could not be decrypted)
[debug] cookie version breakdown: {'v10': 0, 'v11': 317, 'other': 0, 'unencrypted': 0}
[debug] Proxy map: {}
[debug] Loaded 1788 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
yt-dlp is up to date (stable@2023.03.04)
[Panopto] Extracting URL: https://huji.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=64d725f2-972e-42f7-9eeb-afbf0067727a
[Panopto] 64d725f2-972e-42f7-9eeb-afbf0067727a: Downloading JSON metadata
ERROR: [Panopto] 64d725f2-972e-42f7-9eeb-afbf0067727a: This video is only available for registered users. Use --cookies-from-browser or --cookies for the authentication. See https://github.com/yt-dlp/yt-dlp/wiki/FAQ#how-do-i-pass-cookies-to-yt-dlp for how to manually pass cookies
File "/home/ratio/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 694, in extract
ie_result = self._real_extract(url)
File "/home/ratio/.local/lib/python3.8/site-packages/yt_dlp/extractor/panopto.py", line 379, in _real_extract
delivery_info = self._call_api(
File "/home/ratio/.local/lib/python3.8/site-packages/yt_dlp/extractor/panopto.py", line 62, in _call_api
self.raise_login_required(method='cookies')
File "/home/ratio/.local/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 1154, in raise_login_required
raise ExtractorError(msg, expected=True)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 29 (19 by maintainers)
Commits related to this issue
- [cookies] Support chrome table version 24 (#11425) Closes #6564 Authored by: kesor, seproDev Co-authored-by: sepro <sepro@sepr0.com> — committed to c-basalt/yt-dlp by kesor 2 years ago
- [cookies] Support chrome table version 24 (#11425) Closes #6564 Authored by: kesor, seproDev Co-authored-by: sepro <sepro@sepr0.com> — committed to vladisslav2011/yt-dlp by kesor 2 years ago
- [cookies] Support chrome table version 24 (#11425) Closes #6564 Authored by: kesor, seproDev Co-authored-by: sepro <sepro@sepr0.com> — committed to subrat-lima/yt-dlp by kesor 2 years ago
I fixed it by hacking around the problem.
I tracked the “source” of this message:
The decryption of cookies is decoding the decrypted “plaintext” using UTF-8. And for some reason, I didn’t yet track why exactly, there are 32 extra bytes of garbage at the beginning of the string. As others noted, this started very recently.
https://github.com/yt-dlp/yt-dlp/blob/2a24674/yt_dlp/cookies.py#L1013-L1021
The “
return plaintext.decode()” is failing. After comparing values from different steps of the process against my actual cookies, I noticed there were simply extra bytes (garbage? idk…)I changed it to cut off these extra bytes “
return plaintext[32:].decode()” and it stopped failing (for all the cookies).Hopefully this clue leads to someone solving the issue without hacking around it.
This works great! I think a PR should be made with this change as it will keep BC:
@mbway If we try first with the full plaintext before slicing, that should be backwards compatible, yeah?
I was having the same issue with chromium browser (Gnome desktop)
Using seahorse I saw that I had multiple
Chromium Safe Storageentries. In the details of these entries there is a keyapplication, which was set toapplication: chromiumfor one of the entries, but other ones wereapplication: discordandapplication: slack. Once I deleted the other entries, leaving onlyapplication: chromiumone, the cookie extraction started working.sorry, with the rookie issue being posted so recently I assumed it had to be related without looking carefully.
Although the symptom is the same as the original post in this issue thread, this probably warrants a new issue being opened since the cause of these new decryption issues is clear (caused by chrome upgrade).
I have been able to reproduce the error with chrome 130.0.6723.19 on Arch/KDE6.
I read through the changelog for recent changes to cookie storage in chromium but didn’t find anything obvious that could be causing the breakage.
https://chromium.googlesource.com/chromium/src/+log/refs/heads/main/components/os_crypt
I tried playing around with some data as well and have some notes:
v11prefixI’m running into this after updating my system
Arch with Plasma 6.2.1 with kwallet disabled and
--password-store=basicin chromium flags, chromum 130.0.6723.58-1~/.config/kwalletrc contains
For yt-dlp using
--cookies-from-browser chromium:/path/to/custom/profileand seeingwhere previously no issues.