youtube-dl: [YouTube] ERROR: Signature extraction failed, KeyError QV

[Update] This issue is solved: see https://github.com/ytdl-org/youtube-dl/issues/32314#issuecomment-1595779984.

Checklist

  • I’m reporting a broken site support issue
  • I’ve verified that I’m running youtube-dl version 2021.12.17
  • 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 bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://youtube.com/watch?v=zO6vvA4-hBs']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python 3.10.11 (CPython x86_64 64bit) - Linux-5.19.0-45-generic-x86_64-with-glibc2.36 - OpenSSL 1.1.1t  7 Feb 2023 - glibc 2.36
[debug] exe versions: ffmpeg 5.1.1, ffprobe 5.1.1
[debug] Proxy map: {}
[youtube] zO6vvA4-hBs: Downloading webpage
[youtube] zO6vvA4-hBs: Downloading player 6ed0d907
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1585, in _decrypt_signature
    func = self._extract_signature_function(
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1510, in _extract_signature_function
    cache_res = res(test_string)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1574, in <lambda>
    return lambda s: initial_function([s])
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 36, in __call__
    return self.func(*args, **kwargs)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 1037, in resf
    ret, should_abort = self.interpret_statement(code.replace('\n', ' '), var_stack, allow_recursion - 1)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 441, in interpret_statement
    ret, should_return = self.interpret_statement(sub_stmt, local_vars, allow_recursion)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 915, in interpret_statement
    return eval_method(), should_return
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 907, in eval_method
    return obj[idx](argvals, allow_recursion=allow_recursion)
KeyError: 'QV'
 (caused by KeyError('QV')); 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 "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1585, in _decrypt_signature
    func = self._extract_signature_function(
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1510, in _extract_signature_function
    cache_res = res(test_string)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1574, in <lambda>
    return lambda s: initial_function([s])
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 36, in __call__
    return self.func(*args, **kwargs)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 1037, in resf
    ret, should_abort = self.interpret_statement(code.replace('\n', ' '), var_stack, allow_recursion - 1)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 441, in interpret_statement
    ret, should_return = self.interpret_statement(sub_stmt, local_vars, allow_recursion)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 915, in interpret_statement
    return eval_method(), should_return
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 907, in eval_method
    return obj[idx](argvals, allow_recursion=allow_recursion)
KeyError: 'QV'
Traceback (most recent call last):
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1585, in _decrypt_signature
    func = self._extract_signature_function(
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1510, in _extract_signature_function
    cache_res = res(test_string)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1574, in <lambda>
    return lambda s: initial_function([s])
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 36, in __call__
    return self.func(*args, **kwargs)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 1037, in resf
    ret, should_abort = self.interpret_statement(code.replace('\n', ' '), var_stack, allow_recursion - 1)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 441, in interpret_statement
    ret, should_return = self.interpret_statement(sub_stmt, local_vars, allow_recursion)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 915, in interpret_statement
    return eval_method(), should_return
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 907, in eval_method
    return obj[idx](argvals, allow_recursion=allow_recursion)
KeyError: 'QV'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 825, in wrapper
    return func(self, *args, **kwargs)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 846, in __extract_info
    ie_result = ie.extract(url)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 535, in extract
    ie_result = self._real_extract(url)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 2028, in _real_extract
    signature = self._decrypt_signature(sc['s'][0], video_id, player_url)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1595, in _decrypt_signature
    raise ExtractorError(
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1585, in _decrypt_signature
    func = self._extract_signature_function(
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1510, in _extract_signature_function
    cache_res = res(test_string)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1574, in <lambda>
    return lambda s: initial_function([s])
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 36, in __call__
    return self.func(*args, **kwargs)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 1037, in resf
    ret, should_abort = self.interpret_statement(code.replace('\n', ' '), var_stack, allow_recursion - 1)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 441, in interpret_statement
    ret, should_return = self.interpret_statement(sub_stmt, local_vars, allow_recursion)
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 915, in interpret_statement
    return eval_method(), should_return
  File "/var/miniconda3/envs/transcriber/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 907, in eval_method
    return obj[idx](argvals, allow_recursion=allow_recursion)
KeyError: 'QV'
 (caused by KeyError('QV')); please report this issue on https://yt-dl.org/bug .

Description

I am unable to get the filename or download this video. I am using it in python code, but even from the command line the error above occurs.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 29
  • Comments: 32 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I’ll leave this open for now as a honeypot for affected users …

I too have just started getting this error. It occurs on all my attempted downloads both on Mac and Linux.

The issue is fixed (until some new player breaks the hack) in the master code. Follow updating instructions in #31530 until a new release is made.

Just now started getting the same error under Ubuntu 22.04 on every download i try. Cannot validate on other systems currently. Seems like something suddenly changed on YouTubes side, everything still worked perfectly fine about an hour ago. Tried downloading, dumping information only, with and without authentication, used several URLs from single videos and whole playlists, but it’s always the same error for everything i tried. I was using the latest version already but also went and built a fresh version of youtube-dl myself just now from the master branch, but that also changed nothing.

My traceback looks mostly the same, except for the paths up until youtube-dl as i installed it to /usr/local/bin, but find it here anyway if required: https://pastebin.com/UBmBfZPU

I’m having the exact same error. I have the latest version installed. No matter what I’ve tried it still has the same error. Tried it on replit(python), window 10, linux and all have the same error.

@japandotorg, @masterivanic, @shankar-v, @stm32learn, @Arkansis2901, @NStuster: https://github.com/ytdl-org/youtube-dl/issues/32314#issuecomment-1595779984

@thedtvn, you are not running the commit that you think you are, which would have been apparent if you’d posted the whole log.

Per https://github.com/yt-dlp/yt-dlp/issues/7327#issuecomment-1595764214, there is a short-term fix that needs to be verified before pushing to master.

Here too on MacOS.

COMMAND: youtube-dl --extract-audio -f 'bestaudio[ext=m4a]' --get-url 'https://www.youtube.com/watch?v=E4E-rIjfPe0'

OUTPUT:

  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1360, in _decrypt_signature
    func = self._extract_signature_function(
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1277, in _extract_signature_function
    cache_res = res(test_string)
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1344, in <lambda>
    return lambda s: initial_function([s])
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 258, in resf
    res, abort = self.interpret_statement(stmt, local_vars)
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 56, in interpret_statement
    v = self.interpret_expression(expr, local_vars, allow_recursion)
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 182, in interpret_expression
    return obj[member](argvals)
KeyError: 'QV'
 (caused by KeyError('QV')); 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.```

same error, KeyError: ‘QV’ (caused by KeyError(‘QV’));

@japandotorg: #32314 (comment)

@thedtvn, you are not running the commit that you think you are, which would have been apparent if you’d posted the whole log.

sorry

@davidecavaliere, please open a new issue (subject to #30839) for the consent issue, if it affects yt-dl.

The signature JS is like this (player line 2632):

Lsa = {
  a = a.split('');
  AH.QV(a, 46);
  AH.pO(a, 1);
  AH.QV(a, 26);
  AH.LR(a, 56);
  AH.pO(a, 3);
  AH.QV(a, 24);
  AH.pO(a, 2);
  return a.join('')
};

var Lsa is declared at the start of the player. var AH is defined much later, on lines 8734-6:

var AH = {
  LR: function (a, b) {
    var c = a[0];
    a[0] = a[b % a.length];
    a[b % a.length] = c
  },
  QV: function (a) {
    a.reverse()
  },
  pO: function (a, b) {
    a.splice(0, b)
  }
};

Because of var hoisting (thanks Brendan), AH is in scope when the assignment to Lsa is executed. However, we are not constructing or passing the gigantic local context, including AH, to the signature function.

This is a new JS issue introduced with player 6ed0d907.

See also https://github.com/yt-dlp/yt-dlp/issues/7327.

It appears for me at least on MacOS that it’s suddenly working fine now.