Skip to content

Website parsing error: unable to extract reactContext. - #1727

Open
biocoder-frodo wants to merge 1 commit into
CastagnaIT:masterfrom
biocoder-frodo:master
Open

Website parsing error: unable to extract reactContext.#1727
biocoder-frodo wants to merge 1 commit into
CastagnaIT:masterfrom
biocoder-frodo:master

Conversation

@biocoder-frodo

Copy link
Copy Markdown

Fixes regex capture problem that prevents the JSON data from loading correctly.

Check if this PR fulfills these requirements:

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Feature change (non-breaking change which changes behaviour of an existing functionality)
  • Improvement (non-breaking change which improves functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (non-breaking performance or readability improvements)

Description

After getting a correct login for my daughter's Standard plan Netflix subscription using the NFAuthentication flle,
Kodi would greet me with the WebsiteParsingError: Unable to extract reactContext message.
This error was already reported before here:
#1726
#1711
#1706

I already spotted those issues because getting the NFAuthentication key login to work took a little time.
https://github.com/CastagnaIT/plugin.video.netflix/wiki/Login-with-Authentication-key
NFAuthentication.key generation with Firefox

I got the login working after making sure Kodi was using the plugin.video.netflix-1.23.3+matrix.1 version, by going into the Addon options and selecting this version.
After realizing the login worked, I started preparing for some debugging on my LibreElec machine.
I made some changes in the plugin code to log the contents of the response from the Netflix server and see why the code failed.
The website returned/returns JSON data for the reactContext blob followed by </script><script>window.netflix = window.netflix || {};</script>
The plugin script expects to find netflix.reactContext and netflix.falcorCache JSON array assignments inside <script> tags and those tags were causing the problem. The original regex would select including the last </script> on a line returned by the server and this would mean the JSON deserialization would fail because of the trailing script tags.

We have tested the change by watching several episodes in HD without issue and also checked that the two stream limit for the Standard plan was properly checked. The error message that was designed to handle this, showed up.

In case of Feature change / Breaking change:

Describe the current behavior

N/A

Describe the new behavior

N/A

Screenshots (if appropriate):

N/A

Fixes regex capture that prevents the JSON data from loading correctly. The website returned/returns JSON data followed by  </script>script>window.netflix = window.netflix || {};</script>
@homebrew-hgp

homebrew-hgp commented Apr 12, 2025

Copy link
Copy Markdown

I got the problem WebsiteParsingError: Unable to extract reactContext.
yesterday it worked well, but now nothing is working anymore.

Box: RPI3 Libreelec 12.0.2 (amv7) Kodi Nexus.
App version: 1.23.3+matrix.1

Could you please reopen this case?

@biocoder-frodo

Copy link
Copy Markdown
Author

@homebrew-hgp Please check #1732

@atirage21

atirage21 commented Aug 8, 2026

Copy link
Copy Markdown

plugin.video.netflix v1.23.5+matrix.1'

2026-08-08 05:18:40.907 T:2292 info : [script.module.inputstreamhelper] Choosing a version to install is only implemented if the lib is found in googles repo.
2026-08-08 05:18:43.388 T:2292 warning : [script.module.inputstreamhelper] Downloading ChromeOS image for Widevine: jacuzzi (16700.46.0)
2026-08-08 05:18:43.558 T:1568 info : Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2026-08-08 05:20:16.989 T:2292 warning : [script.module.inputstreamhelper] InputStreamHelper version 0.8.5 is running for the first time
2026-08-08 05:20:17.305 T:1695 info : CActiveAESink::OpenSink - initialize sink
2026-08-08 05:20:17.305 T:1695 info : CAESinkALSA::Initialize - Attempting to open device "sysdefault:CARD=hdmi0"
2026-08-08 05:20:17.324 T:1695 info : CAESinkALSA::Initialize - Opened device "sysdefault:CARD=hdmi0"
2026-08-08 05:20:17.324 T:1695 info : CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2026-08-08 05:20:17.325 T:1695 info : CAESinkALSA::InitializeHW - Using data format AE_FMT_S24NE4
2026-08-08 05:20:21.187 T:2294 warning : [script.module.inputstreamhelper]
Kodi version 22.0-BETA1 is running on a Linux system with arm64 architecture.

                                               InputStream Helper is at version 0.8.5 
                                               InputStream Adaptive is at version 22.3.19.1 
                                               
                                               Widevine CDM is at version 4.10.2662.3 and was installed on 2026-07-26 18:03
                                               It was extracted from Chrome OS image DAMU.* with version 16700.46.0
                                               It was last checked for updates on 2026-07-26 18:03
                                               It is installed at /storage/.kodi/cdm/

2026-08-08 05:05:56.977 T:1913 error : [plugin.video.netflix (0)] IPC callback raised exception: Unable to extract reactContext
2026-08-08 05:05:56.990 T:1913 error : [plugin.video.netflix (0)] Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/website.py", line 288, in extract_json
json_str = json_array[0]
~~~~~~~~~~^^^
IndexError: list index out of range

                                               The above exception was the direct cause of the following exception:
                                               
                                               Traceback (most recent call last):
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/http_server.py", line 105, in handle_request
                                                   ret_data = _call_func(func, pickle.loads(data))
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/http_server.py", line 161, in _call_func
                                                   return func(**data)
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
                                                   return func(*args, **kwargs)
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/services/nfsession/session/access.py", line 112, in login_auth_data
                                                   website.extract_session_data(self.get('browse'), validate=True, update_profiles=True)
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
                                                   return func(*args, **kwargs)
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/website.py", line 72, in extract_session_data
                                                   react_context = extract_json(content, 'reactContext')
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
                                                   return func(*args, **kwargs)
                                                 File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/website.py", line 304, in extract_json
                                                   raise WebsiteParsingError(f'Unable to extract {name}') from exc
                                               resources.lib.common.exceptions.WebsiteParsingError: Unable to extract reactContext

2026-08-08 05:05:56.995 T:1903 error : [plugin.video.netflix (1)] Traceback (most recent call last):
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/run_addon.py", line 29, in wrapper
func(*args, **kwargs)
~~~~^^^^^^^^^^^^^^^^^
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/run_addon.py", line 265, in run
success = route(pathitems)
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/run_addon.py", line 88, in lazy_login_wrapper
if G.REQUEST_PARAMS.get('ignore_login') or _check_valid_credentials():
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/run_addon.py", line 73, in _check_valid_credentials
if not login():
~~~~~^^
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/api_requests.py", line 58, in login
if password and common.make_call('login_auth_data', {'data': data, 'password': password}):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/utils/logging.py", line 139, in timing_wrapper
return func(*args, **kwargs)
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/ipc.py", line 94, in make_call
return make_http_call(endpoint, func_name, data)
File "/storage/.kodi/addons/plugin.video.netflix/resources/lib/common/ipc.py", line 117, in make_http_call
raise _data
resources.lib.common.exceptions.WebsiteParsingError: Unable to extract reactContext

@atirage21

Copy link
Copy Markdown

2026-08-08 05:18:40.907 T:2292 info : [script.module.inputstreamhelper] Choosing a version to install is only implemented if the lib is found in googles repo.
2026-08-08 05:18:43.388 T:2292 warning : [script.module.inputstreamhelper] Downloading ChromeOS image for Widevine: jacuzzi (16700.46.0)
2026-08-08 05:18:43.558 T:1568 info : Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2026-08-08 05:20:16.989 T:2292 warning : [script.module.inputstreamhelper] InputStreamHelper version 0.8.5 is running for the first time
2026-08-08 05:20:17.305 T:1695 info : CActiveAESink::OpenSink - initialize sink
2026-08-08 05:20:17.305 T:1695 info : CAESinkALSA::Initialize - Attempting to open device "sysdefault:CARD=hdmi0"
2026-08-08 05:20:17.324 T:1695 info : CAESinkALSA::Initialize - Opened device "sysdefault:CARD=hdmi0"
2026-08-08 05:20:17.324 T:1695 info : CAESinkALSA::InitializeHW - Your hardware does not support AE_FMT_FLOAT, trying other formats
2026-08-08 05:20:17.325 T:1695 info : CAESinkALSA::InitializeHW - Using data format AE_FMT_S24NE4
2026-08-08 05:20:21.187 T:2294 warning : [script.module.inputstreamhelper]
Kodi version 22.0-BETA1 is running on a Linux system with arm64 architecture.

                                               InputStream Helper is at version 0.8.5 
                                               InputStream Adaptive is at version 22.3.19.1 
                                               
                                               Widevine CDM is at version 4.10.2662.3 and was installed on 2026-07-26 18:03
                                               It was extracted from Chrome OS image DAMU.* with version 16700.46.0
                                               It was last checked for updates on 2026-07-26 18:03
                                               It is installed at /storage/.kodi/cdm/

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 this pull request may close these issues.

4 participants