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_dl.utils.ExtractorError: Could not find JS function 'na' #30363

Closed
5 of 6 tasks
MantisTree opened this issue Dec 15, 2021 · 89 comments · Fixed by #30366
Closed
5 of 6 tasks

youtube_dl.utils.ExtractorError: Could not find JS function 'na' #30363

MantisTree opened this issue Dec 15, 2021 · 89 comments · Fixed by #30366

Comments

@MantisTree
Copy link

MantisTree commented Dec 15, 2021

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2021.06.06
  • 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

$ youtube-dl --verbose https://youtu.be/nXPyDlvZ1oQ
[debug] System config: []
[debug] User config: ['--format', 'bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best', '--merge-output-format', 'mp4', '-o', '/data/data/com.termux/files/home/storage/dcim/Camera/%(extractor_key)s-%(uploader)s-%(title)s-%(id)s.%(ext)s', '--no-mtime']
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://youtu.be/nXPyDlvZ1oQ']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.9.1 (CPython) - Linux-4.14.190-22338387-abN975USQS7FUI6-aarch64-with-libc
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1
[debug] Proxy map: {}
[youtube] nXPyDlvZ1oQ: Downloading webpage
[youtube] nXPyDlvZ1oQ: Downloading player 204bfffb
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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 "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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 "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1623, in _real_extract
    signature = self._decrypt_signature(sc['s'][0], video_id, player_url)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1358, in _decrypt_signature
    raise ExtractorError(
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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.

Description

Trying to download video with either url or just video code returns the indicated error

@coletdjnz
Copy link
Contributor

coletdjnz commented Dec 15, 2021

Looks like youtube-dl needs to update the signature function regex.

There is no issue in yt-dlp, seems like this was avoided by yt-dlp/yt-dlp#641.

Back-porting them from yt-dlp works. Relevant code:
https://github.com/yt-dlp/yt-dlp/blob/0bb322b9c0aebb7e0a93a5de1dbede4acdd10ff5/yt_dlp/extractor/youtube.py#L1828-L1845

Edit: Given the above patch by yt-dlp/yt-dlp#641, it may be possible that future player js versions may work again (but also break again at times for the same reason) with existing code.

@stevenroose
Copy link

stevenroose commented Dec 15, 2021

Having the same issue when trying to resume from an existing partial download.

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=ibP5IQxId34', '-f', '248', '--continue']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.10.1 (CPython) - Linux-5.15.7-arch1-1-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.4.1, ffprobe 4.4.1, rtmpdump 2.4
[debug] Proxy map: {}

Can confirm that it works with yt-dlp.

@sumit2089
Copy link

Ran into the same issue when tried to use youtube-dl with audio-format mp3

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--extract-audio', u'--verbose', u'--audio-format', u'mp3', u'https://www.youtube.com/watch?v=9e6JBaFuf_w']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 2.7.18 (CPython) - Darwin-21.1.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Proxy map: {}

With yt-dlp though, this problem does not occur.

@desmeraldoo
Copy link

I am also having this issue, which is impacting Discord bot I maintain.

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=fnlJw9H0xAM']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.9.6 (CPython) - Linux-5.4.0-91-generic-x86_64-with-glibc2.31
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4
[debug] Proxy map: {}

@RedBreloom
Copy link

RedBreloom commented Dec 15, 2021

I am having this extraction/ no 'na' function issue too, but i'm not very savvy with code or python at all. I am using the .exe version of yt-dlg to run youtube-dl, which probably makes a difference.
Is there a way to fix this for that app at the moment or would it need to be updated specifically in yt-dl's backend first? yt-dlg pulls that through its interface. (figure i'd ask here)

@taylrfnt
Copy link

confirmed yt-dlp pull request above fixed this issue for me. Must have been youtube switching their 2 char lookup?

@Marcioghiraldelli
Copy link

I also have this problem of not being able to download more videos or mp3 audios.

@another-dumb-user
Copy link

Having this issue with most youtube URLs (succeeded in downloading one of my own uploads) I think like others here

youtube-dl -f 140 --verbose https://www.youtube.com/watch?v=IC9CZyHLn3M
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-f', '140', '--verbose', 'https://www.youtube.com/watch?v=IC9CZyHLn3M']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.10.1 (CPython) - macOS-10.14.6-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] IC9CZyHLn3M: Downloading webpage
[youtube] IC9CZyHLn3M: Downloading player 204bfffb
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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 "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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 "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1623, in _real_extract
    signature = self._decrypt_signature(sc['s'][0], video_id, player_url)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1358, in _decrypt_signature
    raise ExtractorError(
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/local/Cellar/youtube-dl/2021.6.6_1/libexec/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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.

@lanegramling
Copy link

lanegramling commented Dec 15, 2021

I have submitted a PR (#30366) that resolves this issue. It looks like no PRs have been merged to master in quite some time now, so if you're really in a pinch to resolve this quickly, consider making the changes yourself to extractor/youtube.py in your local environments according to the changes in #30366 , as it is a simple fix (if you are brazen enough to do so).

The problem lies in that Youtube has apparently made some change in their base.js such that the signature parser is taking issue with changes evident in the function signature format. Most are 2 characters (as the regex in the parser assumes) but it seems that 2 characters can no longer be assumed after their update for these signatures. Just needed to tweak the regex to account for that, and I haven't been able to replicate any of these issues since. You can see this for yourself by reviewing base.js at this link: https://www.youtube.com/s/player/850eb2bc/player_ias.vflset/en_US/base.js

Note that this finding was originally made in this PR for yt-dlp and is not mine: yt-dlp/yt-dlp#641. This fix for yt-dlp was spotted by @coletdjnz (good spot) in his earlier comment to this thread.

@philippkeller
Copy link

philippkeller commented Dec 15, 2021

the link to @lanegramling PR is wrong, to see what @lanegramling has changed to reapply to local files see 1a09168

It's quite easy, only 4 lines need changing, all at one place. You just need a few commas in regex.

@lanegramling
Copy link

the link to @lanegramling PR is wrong, to see what @lanegramling has changed to reapply to local files see 1a09168

Good catch, thanks for letting me know. I have updated the links in my comment.

dirkf added a commit to dirkf/youtube-dl that referenced this issue Dec 15, 2021
[youtube] Fix function signature parser (refs ytdl-org/ytdl-org#30363)
@dirkf
Copy link
Contributor

dirkf commented Dec 15, 2021

Fixed in PR #30366, single file signature+unthrottling update from PR #30184.

@UnixCro
Copy link

UnixCro commented Dec 15, 2021

Allright. But how I can install the fixed version?

@dirkf
Copy link
Contributor

dirkf commented Dec 15, 2021

Review this issue. It may take some time.

TL;DR If you have patched against that throttling issue (I don't imagine you would be using yt-dl otherwise), just repeat the procedure.

@PaulCl99
Copy link

same problem here

@harishpillay
Copy link

Same issue on Fedora 35:

[debug] System config: ['--prefer-free-formats']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=kHjzuqq3b44']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.10.0 (CPython) - Linux-5.15.6-200.fc35.x86_64-x86_64-with-glibc2.34
[debug] exe versions: ffmpeg 4.4.1, ffprobe 4.4.1
[debug] Proxy map: {}
[youtube] kHjzuqq3b44: Downloading webpage
[youtube] kHjzuqq3b44: Downloading player 204bfffb
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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 "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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 "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 814, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 835, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1623, in _real_extract
    signature = self._decrypt_signature(sc['s'][0], video_id, player_url)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1358, in _decrypt_signature
    raise ExtractorError(
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
    func = self._extract_signature_function(
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python3.10/site-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python3.10/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
 (caused by ExtractorError("Could not find JS function 'na'; 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.")); 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.

@uwuclxdy
Copy link

I need a solution for my Discord bot written in python please help me with this issue

@Jmackay82
Copy link

YTSearch has the same issue as well

C:\SYS586>c:\sys586\youtube-dl "ytsearch5:DO THEY KNOW ITS CHRISTMAS" --get-id --get-title
ERROR: Signature extraction failed: Traceback (most recent call last):
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\youtube.py", line 1349, in _decrypt_signature
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\youtube.py", line 1262, in _extract_signature_function
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\youtube.py", line 1331, in _parse_sig_js
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\jsinterp.py", line 245, in extract_function
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
(caused by ExtractorError("Could not find JS function 'na'; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.",)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

@dirkf
Copy link
Contributor

dirkf commented Dec 16, 2021

Unsurprising, and also fixed by PR #30366.

When yt-dl processes a playlist, channel, or search, it tries to resolve metadata for each item found, similar to running yt-dl with --list-formats on the item. Then the release code fails because the media links have to be decoded and yt-dl fails to extract the necessary decoding script from the YT player JS.

@MaximFedarau
Copy link

Yeah, I recommend to use yt-dlp or smthn like this, because there is no bug and creators support their creation and i use module in js (yt-dlp-exec) , which has no changes with old and good youtube-dl-exec.

@UserSetting
Copy link

I have the same problem on Linux

$ youtube-dl -f 18 https://www.youtube.com/watch?v=yl8It450z-E
[youtube] yl8It450z-E: Downloading webpage
[youtube] yl8It450z-E: Downloading player f3c4e04d
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
func = self._extract_signature_function(
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/lib/python3/dist-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
(caused by ExtractorError("Could not find JS function 'na'; 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.")); 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.

===============================================

< Here is complete output with --verbose flag >
$ youtube-dl --verbose https://www.youtube.com/watch?v=yl8It450z-E
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=yl8It450z-E']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.9.2 (CPython) - Linux-5.10.0-9-amd64-x86_64-with-glibc2.31
[debug] exe versions: ffmpeg 4.3.3-0, ffprobe 4.3.3-0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] yl8It450z-E: Downloading webpage
[youtube] yl8It450z-E: Downloading player f3c4e04d
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
func = self._extract_signature_function(
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/lib/python3/dist-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
(caused by ExtractorError("Could not find JS function 'na'; 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.")); 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 "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
func = self._extract_signature_function(
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/lib/python3/dist-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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 "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
func = self._extract_signature_function(
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/lib/python3/dist-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
return func(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
ie_result = ie.extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/common.py", line 534, in extract
ie_result = self._real_extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1623, in _real_extract
signature = self._decrypt_signature(sc['s'][0], video_id, player_url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1358, in _decrypt_signature
raise ExtractorError(
youtube_dl.utils.ExtractorError: Signature extraction failed: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1348, in _decrypt_signature
func = self._extract_signature_function(
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1262, in _extract_signature_function
res = self._parse_sig_js(code)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1331, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/usr/lib/python3/dist-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
(caused by ExtractorError("Could not find JS function 'na'; 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.")); 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.

@kawowski
Copy link

already saw some files are change, hope it will be works 😞

@jimlynnjulian
Copy link

You're up a creek without a paddle here, as we all are, to fend for ourselves. The master branch has not seen anything new in 6 months. So there is no existence of the one-step solution to reclaiming a binary you seek. You will have to follow the extra steps to create/collect one yourself if you want to use a binary version. He laid out a great step-by-step, unfortunately your only choices are A) follow it, B) wait indefinitely (likely months or never) for the miraculous return of someone that can pull it into master, or C) switch packages and update your codebases to support the migration. All of the options are bad options, unfortunately...

This brings up an issue in Github. Some of the better programs have dozens, even hundreds, of branches. A system of grading the variants would be useful, at least an icon in the listing to indicate no change/activity in the branch.

@000011111111
Copy link

Yeah, I recommend to use yt-dlp

yt-dlp has the same issue

@pythonmcpi
Copy link

pythonmcpi commented Dec 16, 2021

yt-dlp has the same issue

I just installed the latest version from pip and it works. Make sure you've updated yt-dlp.

@000011111111
Copy link

000011111111 commented Dec 16, 2021

Using yt-dlp worked for me. Workflow here!

https://youtu.be/dAc5VIDIs5k

@jheled
Copy link

jheled commented Dec 16, 2021

I switched to yt-dlp. One unexpected benefit: download speed is much better (youtube-dl got slower and slower in the last few months. I thought this was google throttling me and shrugged)

@DannyBen
Copy link

download speed is much better (youtube-dl got slower and slower in the last few months. I thought this was google throttling me and shrugged)

I had the exact same observation and experience.

@kawowski
Copy link

Official YT-DL working! Big big thanks for developers. Love u

@dirkf
Copy link
Contributor

dirkf commented Dec 17, 2021

I thought this was google throttling me and shrugged

It was, if you hadn't applied the patch from PR #30184.

@Jmackay82
Copy link

A Xmas bonus I thinks guys well done 👍🏼

gaming-hacker added a commit to gaming-hacker/youtube-dl that referenced this issue Dec 20, 2021
* commit '905d1d281ddfa5d183fc445010d350cefc6a58ec':
  Implement n-param descrambling using JSInterp
  Refactor JSInterpreter._separate
  Back-port test_youtube_signature.py from yt-dlp and fix JSInterp accordingly
  Fix splice to handle float
  Handle default in switch better
  Back-port JS interpreter upgrade from yt-dlp PR ytdl-org#1437
  release 2021.12.17
  [ChangeLog] Actualize [ci skip]
  Add compat_map/filter and use the former
  [youtube] Fix function signature parser (refs ytdl-org/ytdl-org#30363)

# Conflicts:
#	youtube_dl/jsinterp.py
#	youtube_dl/version.py
gaming-hacker added a commit to gaming-hacker/youtube-dl that referenced this issue Dec 24, 2021
* commit 'afaec67d45df19642eb4af230b506127af84ceff':
  Fixes 404 Issue Currently Present On XVIDEOS.COM
  release 2021.12.17
  [ChangeLog] Actualize [ci skip]
  [youtube] Update signature function patterns (closes ytdl-org#30363) (ytdl-org#30366)
@Lesmiscore Lesmiscore mentioned this issue Feb 20, 2022
14 tasks
@ealvan
Copy link

ealvan commented Sep 14, 2022

Replace youtube_dl/extractor/youtube.py this file with youtube.py.zip First Extract it

This comment works for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.