youtube-dl: [YouTube] Unable to extract nsig jsi ...
Checklist
- I’m reporting a broken site support
- 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 issues including closed ones
Verbose log
==========================
TESTING NORMAL YOUTUBE-DL:
==========================
[debug] System config: []
[debug] User config: ['--no-mtime', '--match-filter', '!is_live', '--retries', 'infinite', '--fragment-retries', '3', '--skip-unavailable-fragments', '--restrict-filenames', '-i', '-o', '/home/gregorius/home/pending/videos/%(title)s___%(id)s.webm', '-f', '(bestvideo[height<=360]+worstaudio/best[height<=360])[protocol!=http_dash_segments][container!^=dash]', '--console-title', '--hls-prefer-native', '--no-cache-dir', '--http-chunk-size', '100M', '--cookies', '/home/gregorius/home/scripts/video/youtube-dl-cookies']
[debug] Custom config: []
[debug] Command-line args: ['https://www.youtube.com/watch?v=zPHM0q0xgFg', '-vf', '18', '--no-playlist', '-o', '/home/gregorius/home/scripts/video/TEST_NORMAL_%(title)s___%(id)s.webm']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Single file build
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.15.0-112-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg 4.4.2, ffprobe 4.4.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] zPHM0q0xgFg: Downloading webpage
[youtube] Downloading just video zPHM0q0xgFg because of --no-playlist
[youtube] zPHM0q0xgFg: Downloading player b22ef6e7
ERROR: Unable to extract nsig jsi, player_id, func_codefunction code (caused by RegexNotFoundError('Unable to extract \x1b[0;34mInitial JS player n function name\x1b[0m; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.')); please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1637, in _decrypt_nsig
jsi, player_id, func_code = self._extract_n_function_code(video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1680, in _extract_n_function_code
func_name = self._extract_n_function_name(jscode)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1660, in _extract_n_function_name
func_name, idx = self._search_regex(
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/common.py", line 1101, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract Initial JS player n function name; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1637, in _decrypt_nsig
jsi, player_id, func_code = self._extract_n_function_code(video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1680, in _extract_n_function_code
func_name = self._extract_n_function_name(jscode)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1660, in _extract_n_function_name
func_name, idx = self._search_regex(
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/common.py", line 1101, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract Initial JS player n function name; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/YoutubeDL.py", line 875, in wrapper
return func(self, *args, **kwargs)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/YoutubeDL.py", line 971, in __extract_info
ie_result = ie.extract(url)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/common.py", line 571, in extract
ie_result = self._real_extract(url)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 2108, in _real_extract
self._unthrottle_format_urls(video_id, player_url, dct)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1725, in _unthrottle_format_urls
n_response = decrypt_nsig(n_param)(n_param, video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1614, in inner
raise ret
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1606, in inner
self._player_cache[cache_id] = func(*args, **kwargs)
File "/home/gregorius/home/scripts/video/youtube-dl-normal/youtube-dl/youtube_dl/extractor/youtube.py", line 1639, in _decrypt_nsig
raise ExtractorError('Unable to extract nsig jsi, player_id, func_codefunction code', cause=e)
youtube_dl.utils.ExtractorError: Unable to extract nsig jsi, player_id, func_codefunction code (caused by RegexNotFoundError('Unable to extract \x1b[0;34mInitial JS player n function name\x1b[0m; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.')); please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
===========================
TESTING NIGHTLY YOUTUBE-DL:
===========================
[debug] System config: []
[debug] User config: ['--no-mtime', '--match-filter', '!is_live', '--retries', 'infinite', '--fragment-retries', '3', '--skip-unavailable-fragments', '--restrict-filenames', '-i', '-o', '/home/gregorius/home/pending/videos/%(title)s___%(id)s.webm', '-f', '(bestvideo[height<=360]+worstaudio/best[height<=360])[protocol!=http_dash_segments][container!^=dash]', '--console-title', '--hls-prefer-native', '--no-cache-dir', '--http-chunk-size', '100M', '--cookies', '/home/gregorius/home/scripts/video/youtube-dl-cookies']
[debug] Custom config: []
[debug] Command-line args: ['https://www.youtube.com/watch?v=zPHM0q0xgFg', '-vf', '18', '--no-playlist', '-o', '/home/gregorius/home/scripts/video/TEST_NIGHTLY_%(title)s___%(id)s.webm']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2024.07.08 [a452f9437] (single file build)
[debug] ** This version was built from the latest master code at https://github.com/ytdl-org/youtube-dl.
[debug] ** For support, visit the main site.
[debug] Python 3.10.12 (CPython x86_64 64bit) - Linux-5.15.0-112-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg 4.4.2, ffprobe 4.4.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] zPHM0q0xgFg: Downloading webpage
[youtube] Downloading just video zPHM0q0xgFg because of --no-playlist
[youtube] zPHM0q0xgFg: Downloading player b22ef6e7
ERROR: Unable to extract nsig jsi, player_id, func_codefunction code (caused by RegexNotFoundError('Unable to extract \x1b[0;34mInitial JS player n function name\x1b[0m; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.')); please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1637, in _decrypt_nsig
jsi, player_id, func_code = self._extract_n_function_code(video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1680, in _extract_n_function_code
func_name = self._extract_n_function_name(jscode)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1660, in _extract_n_function_name
func_name, idx = self._search_regex(
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/common.py", line 1101, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract Initial JS player n function name; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1637, in _decrypt_nsig
jsi, player_id, func_code = self._extract_n_function_code(video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1680, in _extract_n_function_code
func_name = self._extract_n_function_name(jscode)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1660, in _extract_n_function_name
func_name, idx = self._search_regex(
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/common.py", line 1101, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract Initial JS player n function name; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/YoutubeDL.py", line 879, in wrapper
return func(self, *args, **kwargs)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/YoutubeDL.py", line 975, in __extract_info
ie_result = ie.extract(url)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/common.py", line 571, in extract
ie_result = self._real_extract(url)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 2108, in _real_extract
self._unthrottle_format_urls(video_id, player_url, dct)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1725, in _unthrottle_format_urls
n_response = decrypt_nsig(n_param)(n_param, video_id, player_url)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1614, in inner
raise ret
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1606, in inner
self._player_cache[cache_id] = func(*args, **kwargs)
File "/home/gregorius/home/scripts/video/youtube-dl-nightly/youtube-dl/youtube_dl/extractor/youtube.py", line 1639, in _decrypt_nsig
raise ExtractorError('Unable to extract nsig jsi, player_id, func_codefunction code', cause=e)
youtube_dl.utils.ExtractorError: Unable to extract nsig jsi, player_id, func_codefunction code (caused by RegexNotFoundError('Unable to extract \x1b[0;34mInitial JS player n function name\x1b[0m; please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.')); please report this issue on https://github.com/ytdl-org/youtube-dl/issues , using the appropriate issue template. Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose option and include the complete output.
Description
New Error Message on Youtube, yay, time to provide the Devs with the Logs!
Unable to extract nsig jsi, player_id, func_codefunction code (caused by RegexNotFoundError('Unable to extract \x1b[0;34mInitial JS player n function name\x1b[0m;
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 10
- Comments: 37 (15 by maintainers)
Commits related to this issue
- fix to 'Unable to extract nsig jsi ... #32842' thanks to @Duster98 #issuecomment-2220376175 — committed to tansy/youtube-dl by tansy 2 years ago
Thanks for the report. YT have now discovered that JS
a.split("")can be expressed asString.prototype.split.call(a, ""), and that there is also anArrayclass.This should be fairly easy to fix, though maybe there’s some more nonsense that I haven’t yet noticed .
Indeed, now it’s been fixed twice:
And https://github.com/yt-dlp/yt-dlp/issues/10397#issuecomment-2218169122 too. I’ll combine that in the upcoming yt-dl PR.
I’m using https://github.com/ytdl-org/youtube-dl/commit/e1b3fa242cb94eb9dc949ab3f2cace91c46f11bf and still seeing this issue:
Perhaps yet another player needs this?
To reiterate the solution, the problem is fixed in the master code and builds of 2024–7-11 or later. You can install a fixed release from the nightly builds at ytdl-org/ytdl-nightly. If you are already running a nightly release, and depending on how you installed it, you may be able to update using
-U.If not:
pythonis available; if your Python is calledpython3, create a symbolic link or install a compatibility package (in some Linux Debian releases, python_is_python3), or patch the name of the Python program in the executable using a binary editor or patcher (but must be repeated on each update); in any case remember to mark the download executable (chmod a+x ...)python -m pip ...wherepythonis how you invoke the Python that should run youtube-dl); something likepython -m pip install "URL", where URL is that of the tar.gz archive on the release page, should work on recent pip versions; possibly also specify--force-reinstall.Or if you are using Homebrew, you can install from the latest master code at that time using something like
brew install --HEAD youtube-dl.@dirkf Yes, I know, unfortunately it won’t solve future problems. It might temporarily mitigate the issue. I’m working on a new solution and will let you know.
Do feel free to search for
20dfca59, say, following #30839 as asked, to find the actual issue #32885.After upgrading to the latest nightly build, this issue was initially resolved but has since returned. I’ve followed the instructions in the rest of this thread:
pythoncommand.both of these options return the same error. Note I am using a cookies.txt file, I’ve tried recreating that with a new session, but that also hasn’t resolved the issue. I’ve also tried this on a few youtube videos, all public, all return the same issue.
I’ve included the verbose debug output below, let me know if there is any other info I can provide.
Just came back to say, it works for me with both normal and nightly now, and consider this resolved for me, but I do compile it myself manually, so I can’t tell for the things other people use. ^^
@Duster98 thanks, but as you can see from https://github.com/ytdl-org/youtube-dl/issues/32842#issuecomment-2218272070 a fix is already in progress. Your approach looks like it solves the immediate problem and changes only one file but doesn’t allow for future
prototype-ey stuff. Impatient users could try your patch.Did you read the comments on this issue? Devs know of the problem, fixed it on their end, and a fresh build is coming. Just wait for an update.
I am only here because I am providing Logs, I saw the backlog and just wanted to make sure Data is being delivered. ^^
Edit: by the way it is still broken for player 1f8742dc
Use of nightly builds is already covered in #30839 but may need to be emphasised now that the old build is completely useless for its nominal purpose.
Once the patch is QAed, it’ll be in the next nightly build: there won’t be another until it’s fixed. No more reports of the issue are needed; it’s understood and reproducible.