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

[YouTube] ERROR: Signature extraction failed, KeyError QV #32314

Open
6 tasks done
steelliberty opened this issue Jun 16, 2023 · 32 comments
Open
6 tasks done

[YouTube] ERROR: Signature extraction failed, KeyError QV #32314

steelliberty opened this issue Jun 16, 2023 · 32 comments
Labels
broken-IE problem with existing site extraction fixed

Comments

@steelliberty
Copy link

steelliberty commented Jun 16, 2023

[Update] This issue is solved: see #32314 (comment).

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.

@eric-gilbertson

This comment was marked as duplicate.

@MCStreetguy
Copy link

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

@gilson-emanuel

This comment was marked as duplicate.

@daniel-gonzalez-cedre

This comment was marked as duplicate.

@raulrozza

This comment was marked as duplicate.

@OatsCG
Copy link

OatsCG commented Jun 16, 2023

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.```

@Mochuleo

This comment was marked as duplicate.

@Dmi3Dev

This comment was marked as duplicate.

@jcoy0907

This comment was marked as duplicate.

@NidaCode
Copy link

I got the same Error on Windows 10. The traceback was a lot shorter. Then I tried with yt_dlp (youtube_dlp) and it worked fine with me.

@OatsCG
Copy link

OatsCG commented Jun 17, 2023

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

@davidecavaliere

This comment was marked as off-topic.

@dirkf
Copy link
Contributor

dirkf commented Jun 17, 2023

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

See also yt-dlp/yt-dlp#7327.

@Sergio00166

This comment was marked as duplicate.

@dirkf
Copy link
Contributor

dirkf commented Jun 17, 2023

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.

@Sergio00166

This comment was marked as off-topic.

@stillearnin

This comment was marked as spam.

@dirkf

This comment was marked as resolved.

@stillearnin

This comment was marked as resolved.

@dirkf
Copy link
Contributor

dirkf commented Jun 17, 2023

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

@dirkf

This comment was marked as outdated.

@thedtvn

This comment was marked as duplicate.

@dirkf dirkf closed this as completed in ae8ba2c Jun 17, 2023
@dirkf
Copy link
Contributor

dirkf commented Jun 17, 2023

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.

github-actions bot added a commit to hellopony/youtube-dl that referenced this issue Jun 17, 2023
* https://github.com/ytdl-org/youtube-dl:
  [YouTube] Fix `KeyError QV` in signature extraction failed * temporarily force missing global definition into sig JS * improve test: thanks yt-dlp/yt-dlp#7327 (comment) * resolves ytdl-org#32314
  [jsinterp] Don't find unrelated objects
  [jsinterp] Fix test for failed match in extract_object()
@dirkf
Copy link
Contributor

dirkf commented Jun 17, 2023

I'll leave this open for now as a honeypot for affected users ...

@dirkf dirkf reopened this Jun 17, 2023
@dirkf dirkf added the broken-IE problem with existing site extraction label Jun 18, 2023
@japandotorg

This comment was marked as duplicate.

@dirkf
Copy link
Contributor

dirkf commented Jun 18, 2023

@japandotorg, @masterivanic, @shankar-v, @stm32learn, @Arkansis2901, @NStuster: #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.

@thedtvn

This comment was marked as resolved.

@masterivanic

This comment was marked as duplicate.

@shankar-v

This comment was marked as duplicate.

@dirkf dirkf added the fixed label Jun 20, 2023
@dirkf dirkf changed the title ERROR: Signature extraction failed, KeyError QV [YouTube] ERROR: Signature extraction failed, KeyError QV Jun 20, 2023
@mmahdium

This comment was marked as duplicate.

@Arkansis2901

This comment was marked as duplicate.

@NStuster

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken-IE problem with existing site extraction fixed
Projects
None yet
Development

No branches or pull requests