Skip to content

Commit

Permalink
Unlock all languages
Browse files Browse the repository at this point in the history
resolves gmertes#29
tested with cadium-playercore 6.0033.414.911, 6.0034.588.911, 6.0038.181.911
  • Loading branch information
hyww committed Dec 10, 2022
1 parent 6c14c18 commit fbd15b2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/nflxmultisubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ const hookJsonParseAndAddCallback = function(_window) {
hookJsonParseAndAddCallback(window);


// Hook JSON.stringify() to intercept and modify manifest requests
const hookJsonStringify = function(_window) {
const _stringify = JSON.stringify;
_window.JSON.stringify = (...args) => {
if (args[0] && (args[0].url === 'licensedManifest' || args[0].url === 'manifest')) {
// key name is different for different cadium-playercore versions
// so we check each one by testing two common properties
for (let i in args[0]) {
if (args[0][i] && args[0][i].viewableId && args[0][i].manifestVersion) {
args[0][i].showAllSubDubTracks = true;
args[0][i].supportsPartialHydration = false;
console.log(`Modified manifest request to unlock all sub/dub tracks`);
}
}
}
const result = _stringify.call(JSON, ...args);
return result;
};
};
hookJsonStringify(window);


// hook `history.pushState()` as there is not "pushstate" event in DOM API
// Because Netflix preload manifests when the user hovers mouse over movies on index page,
// our .updateManifest() won't be trigger after user clicks a movie to start watching (they must reload the player page)
Expand Down Expand Up @@ -1396,4 +1418,4 @@ window.addEventListener('keyup', (event) => {

primary.style.visibility = secondary.style.visibility = (visible) ? 'hidden' : 'visible';
}
}, true);
}, true);

0 comments on commit fbd15b2

Please sign in to comment.