mirror of
https://github.com/shirt-dev/netflix-international.git
synced 2025-05-06 00:50:33 +00:00
Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
d0e76f73bf | |||
2d5268217e | |||
aacc5fc76f | |||
79ca463a5a | |||
1ff293ccf3 | |||
de26c23498 | |||
|
cfe541e0e3 | ||
e577af2849 | |||
24b0d31ab5 | |||
3a84478776 | |||
3435e4d136 |
9 changed files with 63 additions and 109 deletions
|
@ -1,47 +0,0 @@
|
||||||
/* eslint-disable no-undef */
|
|
||||||
// https://stackoverflow.com/a/45985333
|
|
||||||
function getBrowser() {
|
|
||||||
if (typeof chrome !== "undefined") {
|
|
||||||
if (typeof browser !== "undefined") {
|
|
||||||
return "Firefox";
|
|
||||||
} else {
|
|
||||||
return "Chrome";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return "Edge";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chrome.webRequest.onBeforeRequest.addListener(
|
|
||||||
function (details) {
|
|
||||||
if (getBrowser() == "Chrome") {
|
|
||||||
return { redirectUrl: chrome.runtime.getURL("cadmium-playercore-shim.js") };
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Work around funky CORS behaviour on Firefox */
|
|
||||||
else if (getBrowser() == "Firefox") {
|
|
||||||
let filter = browser.webRequest.filterResponseData(details.requestId);
|
|
||||||
let encoder = new TextEncoder();
|
|
||||||
filter.onstop = () => {
|
|
||||||
fetch(browser.runtime.getURL("cadmium-playercore-shim.js")).
|
|
||||||
then(response => response.text()).
|
|
||||||
then(text => {
|
|
||||||
filter.write(encoder.encode(text));
|
|
||||||
filter.close();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
console.error("Unsupported web browser.");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
urls: [
|
|
||||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
|
||||||
"*://www.assets.nflxext.com/*/ffe/player/html/*"
|
|
||||||
],
|
|
||||||
types: ["script"]
|
|
||||||
}, ["blocking"]
|
|
||||||
);
|
|
|
@ -41,7 +41,7 @@ function do_patch(desc, needle, replacement) {
|
||||||
the response before the body of this script finishes executing */
|
the response before the body of this script finishes executing */
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
var cadmium_url = document.getElementById("player-core-js").src;
|
var cadmium_url = document.getElementById("player-core-js").src;
|
||||||
request.open("GET", cadmium_url + "?no_filter", false); // synchronous
|
request.open("GET", cadmium_url, false); // synchronous
|
||||||
request.send();
|
request.send();
|
||||||
|
|
||||||
var cadmium_src = request.responseText;
|
var cadmium_src = request.responseText;
|
||||||
|
@ -100,42 +100,16 @@ function get_profile_list(original_profiles) {
|
||||||
profiles = profiles.filter(val => !val.includes("av1-"));
|
profiles = profiles.filter(val => !val.includes("av1-"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (globalOptions.useDDPlus && MediaSource.isTypeSupported('audio/mp4; codecs="ec-3"')) {
|
if (globalOptions.use6Channels) {
|
||||||
// Dolby Digital
|
profiles = profiles.concat([
|
||||||
profiles = profiles.concat([
|
"heaac-5.1-dash",
|
||||||
"ddplus-2.0-dash",
|
]);
|
||||||
]);
|
}
|
||||||
|
|
||||||
if (globalOptions.use6Channels) {
|
|
||||||
profiles = profiles.concat([
|
|
||||||
"ddplus-5.1-dash",
|
|
||||||
"ddplus-5.1hq-dash",
|
|
||||||
"ddplus-atmos-dash",
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// No Dolby Digital
|
|
||||||
if (globalOptions.use6Channels) {
|
|
||||||
profiles = profiles.concat([
|
|
||||||
"heaac-5.1-dash",
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
profiles = [...new Set(profiles)].sort();
|
profiles = [...new Set(profiles)].sort();
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
function get_preferred_locale() {
|
|
||||||
return globalOptions.preferredLocale;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
function get_preferred_text_locale() {
|
|
||||||
return globalOptions.preferredTextLocale;
|
|
||||||
}
|
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Hello world",
|
"Hello world",
|
||||||
/(.*)/,
|
/(.*)/,
|
||||||
|
@ -155,7 +129,7 @@ do_patch(
|
||||||
);
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Re-enable Ctrl+Shift+Alt+S menu",
|
"Re-enable Ctrl+Shift+Alt+B menu",
|
||||||
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
/this\...\....\s*&&\s*this\.toggle\(\);/,
|
||||||
"this.toggle();"
|
"this.toggle();"
|
||||||
);
|
);
|
||||||
|
@ -170,13 +144,13 @@ if (globalOptions.showAllTracks) {
|
||||||
do_patch(
|
do_patch(
|
||||||
"Set preferred audio locale",
|
"Set preferred audio locale",
|
||||||
/preferredAudioLocale:.\.preferredAudioLocale/,
|
/preferredAudioLocale:.\.preferredAudioLocale/,
|
||||||
"preferredAudioLocale: get_preferred_locale()"
|
"preferredAudioLocale: globalOptions.preferredLocale"
|
||||||
);
|
);
|
||||||
|
|
||||||
do_patch(
|
do_patch(
|
||||||
"Set preferred text locale",
|
"Set preferred text locale",
|
||||||
/preferredTextLocale:.\.preferredTextLocale/,
|
/preferredTextLocale:.\.preferredTextLocale/,
|
||||||
"preferredTextLocale: get_preferred_text_locale()"
|
"preferredTextLocale: globalOptions.preferredTextLocale"
|
||||||
);
|
);
|
||||||
|
|
||||||
// run our patched copy of playercore in a non-privileged context on the page
|
// run our patched copy of playercore in a non-privileged context on the page
|
||||||
|
|
BIN
img/icon128.png
BIN
img/icon128.png
Binary file not shown.
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 4.1 KiB |
BIN
img/icon48.png
BIN
img/icon48.png
Binary file not shown.
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 2.1 KiB |
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 3,
|
||||||
"name": "Netflix International",
|
"name": "Netflix International",
|
||||||
"description": "Displays all available Netflix audio and subtitle tracks.",
|
"description": "Displays all available Netflix audio and subtitle tracks.",
|
||||||
"version": "2.0.17",
|
"version": "2.0.23",
|
||||||
"author": "shirt",
|
"author": "shirt",
|
||||||
"browser_action": {
|
"action": {
|
||||||
"default_icon": "img/icon128.png",
|
"default_icon": "img/icon128.png",
|
||||||
"default_popup": "pages/options.html"
|
"default_popup": "pages/options.html"
|
||||||
},
|
},
|
||||||
|
@ -19,8 +19,6 @@
|
||||||
},
|
},
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"matches": [
|
"matches": [
|
||||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
|
||||||
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
"*://www.netflix.com/*"
|
"*://www.netflix.com/*"
|
||||||
],
|
],
|
||||||
|
@ -29,24 +27,35 @@
|
||||||
"js": ["content_script.js"],
|
"js": ["content_script.js"],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}],
|
}],
|
||||||
"background": {
|
|
||||||
"scripts": ["background.js"]
|
|
||||||
},
|
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "pages/options.html",
|
"page": "pages/options.html",
|
||||||
"open_in_tab": true
|
"open_in_tab": true
|
||||||
},
|
},
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [{
|
||||||
"cadmium-playercore-shim.js",
|
"resources": [
|
||||||
"netflix_max_bitrate.js",
|
"cadmium-playercore-shim.js",
|
||||||
"netflix.css"
|
"netflix_max_bitrate.js",
|
||||||
],
|
"netflix.css"
|
||||||
|
],
|
||||||
|
"matches": [
|
||||||
|
"*://assets.nflxext.com/*",
|
||||||
|
"*://netflix.com/*",
|
||||||
|
"*://www.netflix.com/*"
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
"declarative_net_request" : {
|
||||||
|
"rule_resources" : [{
|
||||||
|
"id": "1",
|
||||||
|
"enabled": true,
|
||||||
|
"path": "rules.json"
|
||||||
|
}]
|
||||||
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage",
|
"storage",
|
||||||
"webRequest",
|
"declarativeNetRequestWithHostAccess"
|
||||||
"webRequestBlocking",
|
],
|
||||||
"*://assets.nflxext.com/*/ffe/player/html/*",
|
"host_permissions": [
|
||||||
"*://www.assets.nflxext.com/*/ffe/player/html/*",
|
"*://assets.nflxext.com/*",
|
||||||
"*://netflix.com/*",
|
"*://netflix.com/*",
|
||||||
"*://www.netflix.com/*"
|
"*://www.netflix.com/*"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,7 +6,7 @@ let getElementByXPath = function (xpath) {
|
||||||
};
|
};
|
||||||
|
|
||||||
let fn = function () {
|
let fn = function () {
|
||||||
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']");
|
const VIDEO_SELECT = getElementByXPath("//div[text()='Video Bitrate']") || getElementByXPath("//div[text()='Video Bitrate / VMAF']");
|
||||||
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
const AUDIO_SELECT = getElementByXPath("//div[text()='Audio Bitrate']");
|
||||||
const BUTTON = getElementByXPath("//button[text()='Override']");
|
const BUTTON = getElementByXPath("//button[text()='Override']");
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ let fn = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.dispatchEvent(new KeyboardEvent('keydown', {
|
window.dispatchEvent(new KeyboardEvent('keydown', {
|
||||||
keyCode: 83,
|
keyCode: 66,
|
||||||
ctrlKey: true,
|
ctrlKey: true,
|
||||||
altKey: true,
|
altKey: true,
|
||||||
shiftKey: true,
|
shiftKey: true,
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="disableHPL"><label for="disableHPL">Disable H264 HPL profile</label>
|
<input type="checkbox" id="disableHPL"><label for="disableHPL">Disable H264 HPL profile</label>
|
||||||
<br>
|
<br>
|
||||||
<input type="checkbox" id="useDDPlus"><label for="useDDPlus">Use Dolby Digital Plus (Edge)</label>
|
|
||||||
<br>
|
|
||||||
<label for="preferredLocale">Preferred audio language</label>
|
<label for="preferredLocale">Preferred audio language</label>
|
||||||
<input list="locales" id="preferredLocale" maxlength="5">
|
<input list="locales" id="preferredLocale" maxlength="5">
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -6,7 +6,6 @@ function save_options() {
|
||||||
const disableVP9 = document.getElementById("disableVP9").checked;
|
const disableVP9 = document.getElementById("disableVP9").checked;
|
||||||
const disableAV1 = document.getElementById("disableAV1").checked;
|
const disableAV1 = document.getElementById("disableAV1").checked;
|
||||||
const disableHPL = document.getElementById("disableHPL").checked;
|
const disableHPL = document.getElementById("disableHPL").checked;
|
||||||
const useDDPlus = document.getElementById("useDDPlus").checked;
|
|
||||||
const preferredLocale = document.getElementById("preferredLocale").value;
|
const preferredLocale = document.getElementById("preferredLocale").value;
|
||||||
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
const preferredTextLocale = document.getElementById("preferredTextLocale").value;
|
||||||
|
|
||||||
|
@ -17,7 +16,6 @@ function save_options() {
|
||||||
disableVP9: disableVP9,
|
disableVP9: disableVP9,
|
||||||
disableAV1: disableAV1,
|
disableAV1: disableAV1,
|
||||||
disableHPL: disableHPL,
|
disableHPL: disableHPL,
|
||||||
useDDPlus: useDDPlus,
|
|
||||||
preferredLocale: preferredLocale,
|
preferredLocale: preferredLocale,
|
||||||
preferredTextLocale: preferredTextLocale,
|
preferredTextLocale: preferredTextLocale,
|
||||||
}, function() {
|
}, function() {
|
||||||
|
@ -36,7 +34,6 @@ function reset_options() {
|
||||||
document.getElementById("disableVP9").checked = false;
|
document.getElementById("disableVP9").checked = false;
|
||||||
document.getElementById("disableAV1").checked = true;
|
document.getElementById("disableAV1").checked = true;
|
||||||
document.getElementById("disableHPL").checked = false;
|
document.getElementById("disableHPL").checked = false;
|
||||||
document.getElementById("useDDPlus").checked = false;
|
|
||||||
document.getElementById("preferredLocale").value = null;
|
document.getElementById("preferredLocale").value = null;
|
||||||
document.getElementById("preferredTextLocale").value = null;
|
document.getElementById("preferredTextLocale").value = null;
|
||||||
|
|
||||||
|
@ -47,7 +44,6 @@ function reset_options() {
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
disableAV1: true,
|
disableAV1: true,
|
||||||
disableHPL: false,
|
disableHPL: false,
|
||||||
useDDPlus: false,
|
|
||||||
preferredLocale: null,
|
preferredLocale: null,
|
||||||
preferredTextLocale: null,
|
preferredTextLocale: null,
|
||||||
}, function() {
|
}, function() {
|
||||||
|
@ -67,7 +63,6 @@ function restore_options() {
|
||||||
disableVP9: false,
|
disableVP9: false,
|
||||||
disableAV1: true,
|
disableAV1: true,
|
||||||
disableHPL: false,
|
disableHPL: false,
|
||||||
useDDPlus: false,
|
|
||||||
preferredLocale: null,
|
preferredLocale: null,
|
||||||
preferredTextLocale: null,
|
preferredTextLocale: null,
|
||||||
}, function(items) {
|
}, function(items) {
|
||||||
|
@ -77,7 +72,6 @@ function restore_options() {
|
||||||
document.getElementById("disableVP9").checked = items.disableVP9;
|
document.getElementById("disableVP9").checked = items.disableVP9;
|
||||||
document.getElementById("disableAV1").checked = items.disableAV1;
|
document.getElementById("disableAV1").checked = items.disableAV1;
|
||||||
document.getElementById("disableHPL").checked = items.disableHPL;
|
document.getElementById("disableHPL").checked = items.disableHPL;
|
||||||
document.getElementById("useDDPlus").checked = items.useDDPlus;
|
|
||||||
document.getElementById("preferredLocale").value = items.preferredLocale;
|
document.getElementById("preferredLocale").value = items.preferredLocale;
|
||||||
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
document.getElementById("preferredTextLocale").value = items.preferredTextLocale;
|
||||||
});
|
});
|
||||||
|
|
26
rules.json
Normal file
26
rules.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"priority": 1,
|
||||||
|
"action": {
|
||||||
|
"type": "redirect",
|
||||||
|
"redirect": { "extensionPath": "/cadmium-playercore-shim.js" }
|
||||||
|
},
|
||||||
|
"condition": {
|
||||||
|
"urlFilter": "*://assets.nflxext.com/*/ffe/player/html/*",
|
||||||
|
"resourceTypes": ["script"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"priority": 1,
|
||||||
|
"action": {
|
||||||
|
"type": "redirect",
|
||||||
|
"redirect": { "extensionPath": "/cadmium-playercore-shim.js" }
|
||||||
|
},
|
||||||
|
"condition": {
|
||||||
|
"urlFilter": "*://assets.nflxext.com/player/html/ffe/*",
|
||||||
|
"resourceTypes": ["script"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Add table
Reference in a new issue