Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock all languages #35

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);