youtube-dl: Signature extraction failed: Traceback (most recent call last)

The title says about this issue. Before creating this issue, i already search and read some issues related to mine, such as: #7413 , #10019 , #3255 , #4603 and similar issue in other places by Google search. Most of them said it’s caused by out of date version of youtube-dl.

What i’ve done is like below:

  • uninstall and remove everything any previous youtube-dl on my machine
  • reinstall latest version through pip install --upgrade youtube-dl
  • Uninstall through pip, replace using latest build exe for windows

Same result. None of them are worked.

pip install --upgrade youtube-dl
Collecting youtube-dl
  Using cached youtube_dl-2017.1.8-py2.py3-none-any.whl
Installing collected packages: youtube-dl
Successfully installed youtube-dl-2017.1.8
$ youtube-dl --version
2017.01.08
$ python --version
Python 3.6.0
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.youtube.com/watch?v=yKNxeF4KMsY', '-v']
[debug] Encodings: locale cp1252, fs utf-8, out cp1252, pref cp1252
[debug] youtube-dl version 2017.01.08
[debug] Python version 3.6.0 - Windows-10-10.0.14393-SP0
[debug] exe versions: ffmpeg 2.8.4, ffprobe N-82966-g6993bb4
[debug] Proxy map: {}
[youtube] yKNxeF4KMsY: Downloading webpage
[youtube] yKNxeF4KMsY: Downloading video info webpage
[youtube] yKNxeF4KMsY: Extracting video information
[youtube] {43} signature length 44.40, html5 player en_US-vflsagga9
[youtube] yKNxeF4KMsY: Downloading player https://s.ytimg.com/yts/jsbin/player-en_US-vflsagga9/base.js
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1005, in _decrypt_signature
    video_id, player_url, s
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 932, in _extract_signature_function
    cache_res = res(test_string)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 984, in <lambda>
    return lambda s: initial_function([s])
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 254, in resf
    res, abort = self.interpret_statement(stmt, local_vars)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 55, in interpret_statement
    v = self.interpret_expression(expr, local_vars, allow_recursion)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 174, in interpret_expression
    return obj[member](argvals)
KeyError: 'qC'
 (caused by KeyError('qC',)); 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 "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1005, in _decrypt_signature
    video_id, player_url, s
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 932, in _extract_signature_function
    cache_res = res(test_string)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 984, in <lambda>
    return lambda s: initial_function([s])
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 254, in resf
    res, abort = self.interpret_statement(stmt, local_vars)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 55, in interpret_statement
    v = self.interpret_expression(expr, local_vars, allow_recursion)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 174, in interpret_expression
    return obj[member](argvals)
KeyError: 'qC'
Traceback (most recent call last):
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1005, in _decrypt_signature
    video_id, player_url, s
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 932, in _extract_signature_function
    cache_res = res(test_string)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 984, in <lambda>
    return lambda s: initial_function([s])
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 254, in resf
    res, abort = self.interpret_statement(stmt, local_vars)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 55, in interpret_statement
    v = self.interpret_expression(expr, local_vars, allow_recursion)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 174, in interpret_expression
    return obj[member](argvals)
KeyError: 'qC'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\YoutubeDL.py", line 694, in extract_info
    ie_result = ie.extract(url)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\common.py", line 359, in extract
    return self._real_extract(url)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1584, in _real_extract
    encrypted_sig, video_id, player_url, age_gate)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1015, in _decrypt_signature
    'Signature extraction failed: ' + tb, cause=e)
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 1005, in _decrypt_signature
    video_id, player_url, s
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 932, in _extract_signature_function
    cache_res = res(test_string)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\extractor\youtube.py", line 984, in <lambda>
    return lambda s: initial_function([s])
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 254, in resf
    res, abort = self.interpret_statement(stmt, local_vars)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 55, in interpret_statement
    v = self.interpret_expression(expr, local_vars, allow_recursion)
  File "c:\users\google\appdata\local\programs\python\python36-32\lib\site-packages\youtube_dl\jsinterp.py", line 174, in interpret_expression
    return obj[member](argvals)
KeyError: 'qC'
 (caused by KeyError('qC',)); 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.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 22 (2 by maintainers)

Most upvoted comments

Done and released.

Here’s an ad-hoc fix:

diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 335568a10..aaa8d2b0c 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1267,6 +1267,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
             # Try looking directly into the video webpage
             ytplayer_config = self._get_ytplayer_config(video_id, video_webpage)
             if ytplayer_config:
+                player_url = ytplayer_config.get('url')
                 args = ytplayer_config['args']
                 if args.get('url_encoded_fmt_stream_map'):
                     # Convert to the same format returned by compat_parse_qs
@@ -1552,7 +1553,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
                         jsplayer_url_json = self._search_regex(
                             ASSETS_RE, embed_webpage, 'JS player URL')
 
-                    player_url = json.loads(jsplayer_url_json)
+                    if player_url is None:
+                        player_url = json.loads(jsplayer_url_json)
                     if player_url is None:
                         player_url_json = self._search_regex(
                             r'ytplayer\.config.*?"url"\s*:\s*("[^"]+")',

Please upload dump files if this does not work for you.

“I’m having the same issue” and “+1” comments are just creating noise at this point. It’s a known issue, there will be a fix soon. Please consider this before posting here.

Yet another hack:

Index: youtube_dl/jsinterp.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- youtube_dl/jsinterp.py	(date 1483978139000)
+++ youtube_dl/jsinterp.py	(revision )
@@ -213,7 +213,7 @@
     def extract_object(self, objname):
         obj = {}
         obj_m = re.search(
-            (r'(?:var\s+)?%s\s*=\s*\{' % re.escape(objname)) +
+            (r'(?<!this\.)%s\s*=\s*\{' % re.escape(objname)) +
             r'\s*(?P<fields>([a-zA-Z$0-9]+\s*:\s*function\(.*?\)\s*\{.*?\}(?:,\s*)?)*)' +
             r'\}\s*;',
             self.code)