youtube_dl.utils.ExtractorError: Could not find JS function 'na'
See original GitHub issueChecklist
- 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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:77
- Comments:89 (16 by maintainers)
Top Results From Across the Web
python - raise ExtractorError('Could not find JS function %r ...
I was having this exact same problem on version 2021.6.6 which I was using but decided to upgrade using this command:
Read more >[Solved] raise ExtractorError('Could not find JS function %r ...
Today I am not able to download youtube video with youtube_dl python package And I am facing following error raise ExtractorError('Could not ......
Read more >Bug #1632334 “ExtractorError: Could not find JS function u'Ft'”
Be sure to call youtube-dl with the --verbose flag and include its complete output. (caused by ExtractorError(u"Could not find JS function ...
Read more >No longer able to download YouTube using youtube-dl. How ...
Be sure to call youtube-dl with the --verbose flag and include its complete output. (caused by ExtractorError("Could not find JS function 'na'; ...
Read more >youtube-dl stopped working i have no idea how to fix - Reddit
utils.ExtractorError: Could not find JS function 'na'; please report this issue on https://yt-dl.org/bug . Make sure you are ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
Official YT-DL working! Big big thanks for developers. Love u