Website parsing error: unable to extract reactContext. #1727
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes regex capture problem that prevents the JSON data from loading correctly.
Check if this PR fulfills these requirements:
Types of changes
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
andnetflix.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